Giter VIP home page Giter VIP logo

Comments (42)

sqall01 avatar sqall01 commented on May 29, 2024

Hi,

  1. the database and tables should be created automatically by alertR. Please check the log files if there is some form of error. What backend do you use for the server (sqlite, mysql)? For the testing/beginning I would recommend sqlite.

  2. When the server is installed, configured and started, the clients can connect to it.

  3. Yes, the phone app is using the web browser of the phone to access the web page. The only thing the phone app does is store the .htaccess information in order to automatically log in to the web page. This is the reason, I did not put an app into the app store at the moment. One thing on my to-do list is a native app. But the priority for it is not really high at the moment.

  4. This would be great. I had already started writing new tutorials for version 0.4 (and foremost to make the tutorials better ... the current one is crap). My plan is to make one tutorial for each alertR instance (server, client, ...) and perhaps some additional tutorials for things like connecting the window to alertR or something like that. Perhaps, I am able to publish the server tutorial this weekend.

from alertr.

rlefever avatar rlefever commented on May 29, 2024

I used mySQL since I am more familiar with it.

When I ran the dependency checker I saw I needed mysql-python but nowhere
did any instruction say I needed to install mySQL. So I used sudo apt-get
install mysql-server and ran the CREATE and GRANT portion of the script
when directed.

The error logs show:
ERROR: 1064 You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET
utf8 NOT ' at line 1
160608 2:12:25 [ERROR] Aborting

Hope this helps. How do I recover from this?

Hi,

  1. the database and tables should be created automatically by alertR.
    Please check the log files if there is some form of error. What backend do
    you use for the server (sqlite, mysql)? For the testing/beginning I would
    recommend sqlite.

  2. When the server is installed, configured and started, the clients can
    connect to it.

  3. Yes, the phone app is using the web browser of the phone to access the
    web page. The only thing the phone app does is store the .htaccess
    information in order to automatically log in to the web page. This is the
    reason, I did not put an app into the app store at the moment. One thing
    on my to-do list is a native app. But the priority for it is not really
    high at the moment.

  4. This would be great. I had already started writing new tutorials for
    version 0.4 (and foremost to make the tutorials better ... the current one
    is crap). My plan is to make one tutorial for each alertR instance
    (server, client, ...) and perhaps some additional tutorials for things
    like connecting the window to alertR or something like that. Perhaps, I am
    able to publish the server tutorial this weekend.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#15 (comment)

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

This error is from the mysql log file correct? This is really strange, because the alertR server not use ALTER TABLE. The only SQL commands it uses are CREATE, SELECT, UPDATE, INSERT and DELETE.

Are you sure you have given the user you are using for the alertR server the correct permissions? To be able to use the alertR server with MySQL, you have to do the following manually before:

mysql> create database alertr;
mysql> CREATE USER 'alertr'@'localhost' IDENTIFIED BY '';
mysql> GRANT ALL ON alertr.* TO 'alertr'@'localhost';

This creates the database "alertr" and the user "alertr" that has full access to the database. The credentials have to be configured in the alertR server configuration file.

Are there any error messages in the alertR log file?

from alertr.

rlefever avatar rlefever commented on May 29, 2024

I did set the attributes in /server/config/config.xml

    </storage>

via mysql -u root -p
mysql> create database alertr; -> gives me database already exists

mysql> CREATE USER 'alertr'@'localhost' IDENTIFIED BY '<my_pwd>';

ERROR 1396 (HY000): Operation CREATE USER failed for 'alertr'@'localhost'

But currently shows in information_schema
'alertr'@'localhost' | def | USAGE | NO

mysql->user shows
| localhost | alertr | <pwd_hidden> | with a lot of N's

mysql> GRANT ALL ON alertr.* TO 'alertr'@'localhost';

Query OK, 0 rows afftected (0,00 sec)

mysql->db shows
|localhost | alertr | alertr | with a lot of Y's

Where is the alertr's log?

This error is from the mysql log file correct? This is really strange,
because the alertR server not use ALTER TABLE. The only SQL commands it
uses are CREATE, SELECT, UPDATE, INSERT and DELETE.

Are you sure you have given the user you are using for the alertR server
the correct permissions? To be able to use the alertR server with MySQL,
you have to do the following manually before:

mysql> create database alertr;
mysql> CREATE USER 'alertr'@'localhost' IDENTIFIED BY '';
mysql> GRANT ALL ON alertr.* TO 'alertr'@'localhost';

This creates the database "alertr" and the user "alertr" that has full
access to the database. The credentials have to be configured in the
alertR server configuration file.

Are there any error messages in the alertR log file?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#15 (comment)

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

In the configuration file you configured the log directory. Something like this:

<general>
    <log
        dir="/home/sqall/projekte/alertR/server_log"
        level="DEBUG" />

There you have the log files. A server log file, one log file for each client that is connected and one log file that combines all log entries.

from alertr.

rlefever avatar rlefever commented on May 29, 2024

I thought that dir was the directory for the log file and left it as /var/log and level="INFO"

There is not server.log in /var/log

Change this and run the setup again?

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

This can be the reason why the alertR server does not create the tables
in the database. Normally, /var/log is only writable by root or users in
the syslog group. I assume you start the alertR server under a "normal"
user. Therefore, it should not be able to write into the directory.

Please change the log directory to a directory that is writable by the
user that starts the alertR server.

On 10.06.2016 23:49, rlefever wrote:

I thought that dir was the directory for the log file and left it as /var/log and level="INFO"

There is not server.log in /var/log

Change this and run the setup again?


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#15 (comment)

Andre Pawlowski


Your birth is a mistake you'll spend your whole life trying to correct.
-Invisible Monsters (Ellis Island)

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

I have just seen that I did not have a correct config file template in the installation directory. I have updated it. Please re-install your server (or use the update function) to get the new configuration template.

Also I have just published a tutorial on how to set up the alertR server: https://github.com/sqall01/alertR/wiki/Tutorial---Server

Hope this will make things clearer.

from alertr.

rlefever avatar rlefever commented on May 29, 2024

Making progress. Current error when starting on reboot:

06/12/2016 10:39:35 ERROR: [alertRserver.py]: Could not parse config.
Traceback (most recent call last):
File "/home/pi/server/alertRserver.py", line 870, in
globalData)
File "/home/pi/server/lib/storage.py", line 3187, in init
self._openConnection()
File "/home/pi/server/lib/storage.py", line 3264, in _openConnection
user=self.username, passwd=self.password, db=self.database)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/init.py", line 81, in Connect
return Connection(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 193, in init
super(Connection, self).init(_args, *_kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' (111)")

config.xml is owned by the user in ~/server/config/

There is nothing in mysql.log nor mysql.err
I can log into the mysql server with mysql -u alertr -p

when I run ~/server/alertRserver.py as pi (since I started the install before the tutorial with creating the alertr user) it works. No errors.

the /etc/init.d/alertRserver.sh has user=pi

I noticed the alertr user is setup without a password. Could the fact that user pi has a password be the problem?

I created the alertr user as directed and tried to su alertr command. It ask me for a password and failed when i did not enter one. (turns out it was because I used sudo and tried to su to alertr from pi instead of from root).

if I wanted to uninstall/reinstall, I assume I could just delete the ~/server directory and start from the beginning, correct?

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

Making progress. Current error when starting on reboot:

06/12/2016 10:39:35 ERROR: [alertRserver.py]: Could not parse config.
Traceback (most recent call last):
File "/home/pi/server/alertRserver.py", line 870, in
globalData)
File "/home/pi/server/lib/storage.py", line 3187, in init
self.openConnection()
File "/home/pi/server/lib/storage.py", line 3264, in openConnection
user=self.username, passwd=self.password, db=self.database)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/__init.py", line 81, in Connect
return Connection(args, *kwargs)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 193, in init
super(Connection, self).init(args, *kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' (111)")

Are you sure the settings you put into the config file are correct? Did you change something in the mysql configuration? It seems like mysql does not allow the connection. Like in this stackoverflow post: http://stackoverflow.com/questions/1420839/cant-connect-to-mysql-server-error-111 Please try

mysql -u alertr -p -h 127.0.0.1

and

mysql -u alertr -p -h localhost

If "localhost" is working, please change it in your alertr settings.

I noticed the alertr user is setup without a password. Could the fact that user pi has a password be the problem?

No, it could not.

I created the alertr user as directed and tried to su alertr command. It ask me for a password and failed when i did not enter one. (turns out it was because I used sudo and tried to su to alertr from pi instead of from root).

This does only work if you switch from the root user to the alertr user. Otherwise you get a password prompt for the alertr user. I updated the documentation with a note.

if I wanted to uninstall/reinstall, I assume I could just delete the ~/server directory and start from the beginning, correct?

Correct.

from alertr.

rlefever avatar rlefever commented on May 29, 2024

I have the logging level set to DEBUG

I can run the program directly from the prompt as user pi no problem.

When I sudo su to root or 'sudo service' to try to start the service,

/etc/init.d/alertRserver.sh start
[ ok ] Starting alertRserver.sh (via systemctl): alertRserver.service.

the all.log and server.log are not created.

They are when I reboot and have the error below.

Seems that the line "Could not parse config" leads to the problem with
connecting to mysql but I don't know why. The config file seems to be fine
since I can sun the program directly.

Seems to be a problem with the alertRserver.sh parsing the config file. It
is like it is not running as root, but even if it is switching to user pi
it should be able to read the config file.
-rw-r--r-- 1 pi pi 28864 Jun 15 07:57 config.xml

It seems that when starting as root it is not looking in the right place for the config file and therefore unable to parse it.

Making progress. Current error when starting on reboot:

06/12/2016 10:39:35 ERROR: [alertRserver.py]: Could not parse config.
Traceback (most recent call last):
File "/home/pi/server/alertRserver.py", line 870, in
globalData)
File "/home/pi/server/lib/storage.py", line 3187, in init
self.openConnection()
File "/home/pi/server/lib/storage.py", line 3264, in openConnection
user=self.username, passwd=self.password, db=self.database)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/__init.py", line
81, in Connect
return Connection(args, *kwargs)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py",
line 193, in init
super(Connection, self).init(args, *kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1'
(111)")

Are you sure the settings you put into the config file are correct? Did
you change something in the mysql configuration? It seems like mysql does
not allow the connection. Like in this stackoverflow post:
http://stackoverflow.com/questions/1420839/cant-connect-to-mysql-server-error-111
Please try

mysql -u alertr -p -h 127.0.0.1

and

mysql -u alertr -p -h localhost

If "localhost" is working, please change it in your alertr settings.

I noticed the alertr user is setup without a password. Could the fact
that user pi has a password be the problem?

No, it could not.

I created the alertr user as directed and tried to su alertr command. It
ask me for a password and failed when i did not enter one. (turns out it
was because I used sudo and tried to su to alertr from pi instead of
from root).

This does only work if you switch from the root user to the alertr user.
Otherwise you get a password prompt for the alertr user. I updated the
documentation with a note.

if I wanted to uninstall/reinstall, I assume I could just delete the
~/server directory and start from the beginning, correct?

Correct.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#15 (comment)

from alertr.

rlefever avatar rlefever commented on May 29, 2024

I placed a print globalData.configFile under the globalData = GlobalData() statement in alertRserver.py.

When I run it as pi I get /home/pi/server/lib/../config/config.xml
When I sudo service alertRserver start nothing is returned even though I removed --quiet and -b from the alertRserver.sh start_stop_daemon command.

Both work
mysql -u alertr -p -h 127.0.0.1

and

mysql -u alertr -p -h localhost

changing it in the config.xml does not help.

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

Ok, you jump from one thing to another. At the moment I have no idea what does work and what not.

I can run the program directly from the prompt as user pi no problem.

So this means you do not get the MySQL error anymore? And the log file says that the server has started? This is important. Because we have to establish a base line of what is working. The service configuration does not matter as long as it does not work as a normal user.

When I sudo su to root or 'sudo service' to try to start the service,
/etc/init.d/alertRserver.sh start
[ ok ] Starting alertRserver.sh (via systemctl): alertRserver.service.

the all.log and server.log are not created. They are when I reboot and have the error below. Seems that the line "Could not parse config" leads to the problem with connecting to mysql but I don't know why. The config file seems to be fine since I can sun the program directly.

The "Could not parse config" line can come from that, yes. Because during the parsing of the configuration file a connection to the mysql server is established. But there should be more than that. If the connection can not be established, there should be some sort of call stack and error message.

Does your system use systemd? Because this is really nasty to configure to have a service running. There could be a problem if everything is working when you are executing it as a normal user.

It seems that when starting as root it is not looking in the right place for the config file and therefore unable to parse it.

I do not think so because the server is always looking in the "config" directory in the same folder it is.

I placed a print globalData.configFile under the globalData = GlobalData() statement in alertRserver.py.

When I run it as pi I get /home/pi/server/lib/../config/config.xml
When I sudo service alertRserver start nothing is returned even though I removed --quiet and -b from the alertRserver.sh start_stop_daemon command.

I do not think that you get any output if you use service. If you really want to check if it does not work as another user than "pi", the please try:

sudo bash
cd /etc/init.d/
/path/to/alertRserver.py

With this commands you change to the "root" user, change the directory and then execute the alertR server. This way you can see if the config.xml is really not found and get every output.

Both work
mysql -u alertr -p -h 127.0.0.1

and

mysql -u alertr -p -h localhost

changing it in the config.xml does not help.

Again, is the mysql connection problem solved or not? The message above reads like it is.

Because we are doing a lot of things at the same time that can be somehow connected to each other, please let us concentrate on the following first: We want to have the alertR server manually running as the user "pi". No autostart, no service, no daemon. Just manually executed with "/path/to/alertRserver.py" (not "python /path/to/alertRserver.py"). When the log file says something like "server is running" we focus on the next thing, ok?

from alertr.

rlefever avatar rlefever commented on May 29, 2024

pi@alertr-server:~/server/logs $ ~/server/alertRserver.py

06/16/2016 07:18:07 DEBUG: [alertRserver.py]: Parsing smtp configuration.
06/16/2016 07:18:07 DEBUG: [alertRserver.py]: Parsing update configuration.
06/16/2016 07:18:07 DEBUG: [alertRserver.py]: Parsing user backend configuration.
06/16/2016 07:18:07 DEBUG: [alertRserver.py]: Parsing storage backend configuration.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [alertRserver.py]: Parsing survey configuration.
06/16/2016 07:18:07 DEBUG: [alertRserver.py]: Parsing server configuration.
06/16/2016 07:18:07 DEBUG: [alertRserver.py]: Parsing alert levels configuration.
06/16/2016 07:18:07 INFO: [alertRserver.py]: Parsed rules for alert level 20.
06/16/2016 07:18:07 INFO: [alertRserver.py]: RULE (order=0, minTimeAfterPrev=0.00, maxTimeAfterPrev=0.00, counterActivated=False, counterLimit=0, counterWaitTime=0)
06/16/2016 07:18:07 INFO: [alertRserver.py]: and
06/16/2016 07:18:07 INFO: [alertRserver.py]: sensor (triggeredFor=5.00, user=sensordev, remoteId=0)
06/16/2016 07:18:07 INFO: [alertRserver.py]: sensor (triggeredFor=5.00, user=sensordev, remoteId=0)
06/16/2016 07:18:07 INFO: [alertRserver.py]: RULE (order=1, minTimeAfterPrev=0.00, maxTimeAfterPrev=5.00, counterActivated=False, counterLimit=0, counterWaitTim
e=0)
06/16/2016 07:18:07 INFO: [alertRserver.py]: or
06/16/2016 07:18:07 INFO: [alertRserver.py]: weekday (time=utc, weekday=0)
06/16/2016 07:18:07 INFO: [alertRserver.py]: weekday (time=utc, weekday=1)
06/16/2016 07:18:07 INFO: [alertRserver.py]: weekday (time=utc, weekday=2)
06/16/2016 07:18:07 INFO: [alertRserver.py]: weekday (time=utc, weekday=3)
06/16/2016 07:18:07 INFO: [alertRserver.py]: weekday (time=utc, weekday=4)
06/16/2016 07:18:07 INFO: [alertRserver.py]: RULE (order=2, minTimeAfterPrev=0.00, maxTimeAfterPrev=5.00, counterActivated=False, counterLimit=0, counterWaitTime=0)
06/16/2016 07:18:07 INFO: [alertRserver.py]: and
06/16/2016 07:18:07 INFO: [alertRserver.py]: hour (time=utc, start=15, end=20)
06/16/2016 07:18:07 INFO: [alertRserver.py]: minute (start=0, end=59)
06/16/2016 07:18:07 INFO: [alertRserver.py]: second (start=0, end=20)
06/16/2016 07:18:07 INFO: [alertRserver.py]: RULE (order=3, minTimeAfterPrev=0.00, maxTimeAfterPrev=5.00, counterActivated=True, counterLimit=1, counterWaitTime=82800)
06/16/2016 07:18:07 INFO: [alertRserver.py]: not
06/16/2016 07:18:07 INFO: [alertRserver.py]: or
06/16/2016 07:18:07 INFO: [alertRserver.py]: monthday (time=utc, monthday=1)
06/16/2016 07:18:07 INFO: [alertRserver.py]: monthday (time=utc, monthday
06/16/2016 07:18:07 INFO: [alertRserver.py]: monthday (time=utc, monthday=1)
06/16/2016 07:18:07 INFO: [alertRserver.py]: monthday (time=utc, monthday=2)
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [alertRserver.py]: Parsing internal sensors configuration.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 INFO: [storage.pyc]: Sensor with client id '0' already exists in database.
06/16/2016 07:18:07 INFO: [storage.pyc]: Sensor with client id '1' already exists in database.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [alertRserver.py]: Parsing configuration succeeded.
06/16/2016 07:18:07 INFO: [alertRserver.py] Starting sensor alert manage thread.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 INFO: [alertRserver.py] Starting manager client manage thread.
06/16/2016 07:18:07 INFO: [alertRserver.py] Starting server thread.
06/16/2016 07:18:07 INFO: [alertRserver.py] Starting watchdog thread.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.
06/16/2016 07:18:07 INFO: [alertRserver.py] Starting update check thread.
06/16/2016 07:18:07 INFO: [alertRserver.py] Server started.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Release lock.
06/16/2016 07:18:07 DEBUG: [storage.pyc]: Acquire lock.

Seems to work fine.

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

It does. Great. What did solve the mysql connection error?

This was for a manual start with the "pi" user? Or was it already for the service?

from alertr.

rlefever avatar rlefever commented on May 29, 2024

This was as "pi"

I only get the failure and error when I reboot.

It does. Great. What did solve the mysql connection error?

This was for a manual start with the "pi" user? Or was it already for the
service?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#15 (comment)

from alertr.

rlefever avatar rlefever commented on May 29, 2024

This is what is in all.log on reboot

06/16/2016 08:35:08 DEBUG: [alertRserver.py]: Parsing smtp configuration.
06/16/2016 08:35:08 DEBUG: [alertRserver.py]: Parsing update configuration.
06/16/2016 08:35:08 DEBUG: [alertRserver.py]: Parsing user backend configuration.
06/16/2016 08:35:08 DEBUG: [alertRserver.py]: Parsing storage backend configuration.
06/16/2016 08:35:08 ERROR: [alertRserver.py]: Could not parse config.
Traceback (most recent call last):
File "/home/pi/server/alertRserver.py", line 870, in
globalData)
File "/home/pi/server/lib/storage.py", line 3187, in init
self._openConnection()
File "/home/pi/server/lib/storage.py", line 3264, in _openConnection
user=self.username, passwd=self.password, db=self.database)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/init.py", line 81, in Connect
return Connection(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 193, in init
super(Connection, self).init(_args, *_kwargs2)
OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")

If I delete the logs and try to start the service, no logs get created.

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

Ah. Now I know what is going on. This is because the MySQL server is not started yet but the alertR server is.

Does your system use systemd? Can you tell me the content of your /etc/rc2.d/ directory? With this I can see the order in which your processes are started.

from alertr.

rlefever avatar rlefever commented on May 29, 2024

I don't think Rasbian Jessie uses systemd but I really don't know.

pi@alertr-server:/etc/rc2.d $ ls
README S03dbus S04lightdm
S01bootlogs S03dphys-swapfile S04postfix
S01dhcpcd S03mysql S05alertRmanagerDatabase.sh
S01motd S03ntp S05alertRserver.sh
S01rsyslog S03rsync S05plymouth
S01triggerhappy S03ssh S05rc.local
S02apache2 S04avahi-daemon S05rmnologin
S03cron S04bluetooth

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

Mh, the mysql server should be started before the alertR server. Just to make sure I am correct, can you please exchange the line:

if name == 'main':

with

time.sleep(10)
if name == 'main':

in alertRserver.py and reboot.

from alertr.

rlefever avatar rlefever commented on May 29, 2024

That seems to have fixed it.

Mh, the mysql server should be started before the alertR server. Just to
make sure I am correct, can you please exchange the line:

if name == 'main':

with

time.sleep(10)
if name == 'main':

in alertRserver.py and reboot.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#15 (comment)

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

Thanks. I will work on something that will fix this problem for good.
This is also needed for the database manager client since it uses mysql.

On 16.06.2016 15:26, rlefever wrote:

That seems to have fixed it.

Mh, the mysql server should be started before the alertR server. Just to
make sure I am correct, can you please exchange the line:

if name == 'main':

with

time.sleep(10)
if name == 'main':

in alertRserver.py and reboot.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#15 (comment)


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#15 (comment)

Andre Pawlowski


Your effort to remain what you are is what limits you.
-Ghost in the Shell (Puppet Master)

from alertr.

rlefever avatar rlefever commented on May 29, 2024

Does the database manager require a Server CA ? I am getting an error there that it does not exist but it is a different problem that what we just fixed. May need to be a new issue.

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

It requires the server certificate to check if the connection to the
server is authenticated. This means you need to give it the certificate
(not the key) you created for the server.

On 16.06.2016 15:31, rlefever wrote:

Does the database manager require a Server CA ? I am getting an error there that it does not exist but it is a different problem that what we just fixed. May need to be a new issue.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#15 (comment)

Andre Pawlowski


Your effort to remain what you are is what limits you.
-Ghost in the Shell (Puppet Master)

from alertr.

rlefever avatar rlefever commented on May 29, 2024

So direct it to ~/server/server.crt or server.csr instead of a .pem?

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

Should be working, yes.

On 16.06.2016 15:47, rlefever wrote:

So direct it to ~/server/server.crt instead of a .pem?


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#15 (comment)

Andre Pawlowski


Right and wrong are not what seperate us and our enemies.
It's our different standpoints, our perspectives that
seperate us. Both sides blame one another. There's no
good or bad side. Just two sides holding different views.
-Final Fantasy VIII (Squall Leonhart)

from alertr.

rlefever avatar rlefever commented on May 29, 2024

from my manageClientDatabase/config/config.xml

on reboot, managerClientDatabase log shows
06/16/2016 10:03:35 ERROR: [alertRclient.py]: Could not parse config.
Traceback (most recent call last):
File "/home/pi/managerClientDatabase/alertRclient.py", line 90, in
raise ValueError("Server CA does not exist.")
ValueError: Server CA does not exist.

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

I think the error message "Server CA does not exist." is pretty clear,
isn't it? It means that the file you are trying to open does not exist.
In the code it looks like this:

if os.path.exists(serverCAFile) is False:
raise ValueError("Server CA does not exist.")

On 16.06.2016 16:07, rlefever wrote:

from my manageClientDatabase/config/config.xml

on reboot, managerClientDatabase log shows
06/16/2016 10:03:35 ERROR: [alertRclient.py]: Could not parse config.
Traceback (most recent call last):
File "/home/pi/managerClientDatabase/alertRclient.py", line 90, in
raise ValueError("Server CA does not exist.")
ValueError: Server CA does not exist.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#15 (comment)

Andre Pawlowski


Right and wrong are not what seperate us and our enemies.
It's our different standpoints, our perspectives that
seperate us. Both sides blame one another. There's no
good or bad side. Just two sides holding different views.
-Final Fantasy VIII (Squall Leonhart)

from alertr.

rlefever avatar rlefever commented on May 29, 2024

Sorry, I now see my mistake. Make the path correct and the program works. Thanks for your patients and your help. Work on the Web interface next.

So far i get "Loading ..."

from alertr.

rlefever avatar rlefever commented on May 29, 2024

I changed /home/sqall/alertR/alertRmanagerDatabase/config/localsocket
to
/tmp/local.socket (per the managerClientDatabase config.xml)
in var/www/alertr/config/config.php but I do not see that loca.lsocket is created.

Should it be somewhere else in v.4?

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

Did you activated the socket server in the configuration file?

On 16.06.2016 16:30, rlefever wrote:

I changed /home/sqall/alertR/alertRmanagerDatabase/config/localsocket
to
/tmp/local.socket (per the managerClientDatabase config.xml)
in var/www/alertr/config/config.php but I do not see that loca.lsocket is created.

Should it be somewhere else in v.4?


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#15 (comment)

Andre Pawlowski


Right and wrong are not what seperate us and our enemies.
It's our different standpoints, our perspectives that
seperate us. Both sides blame one another. There's no
good or bad side. Just two sides holding different views.
-Final Fantasy VIII (Squall Leonhart)

from alertr.

rlefever avatar rlefever commented on May 29, 2024

yes, per
$configUnixSocketActive = true;
in /var/www/alertr/config/config.php

and in ~/managerClientDatabase/config/config.xml

from alertr.

rlefever avatar rlefever commented on May 29, 2024

Think I may have found it.
/etc/mysql/my.cnf says => /var/run/mysqld/mysqld.sock

Changing both alertr configs and rebooting.

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

The local unixsocket has nothing to do with the mysqld socket.

On 16.06.2016 16:59, rlefever wrote:

Think I may have found it.
/etc/mysql/my.cnf says => /var/run/mysqld/mysqld.sock

Changing both alertr configs and rebooting.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#15 (comment)

Andre Pawlowski


He will win who knows when to fight and when not to fight.
-The Art of War (Sun Tzu)

from alertr.

rlefever avatar rlefever commented on May 29, 2024

Changed them back and rebooted.

Disabled unixsocket in managerClientDatabase/config/config.xml and /var/www/alertr/config/config.php

Currently getting the following in ~/managerClientDatabase/all.log

06/16/2016 12:38:48 ERROR: [client.pyc]: Connecting to server failed.
Traceback (most recent call last):
File "/home/pi/managerClientDatabase/lib/client.py", line 2315, in initializeCommunication
self.client.connect()
File "/home/pi/managerClientDatabase/lib/client.py", line 54, in connect
self.sslSocket.connect((self.host, self.port))
File "/usr/lib/python2.7/ssl.py", line 824, in connect
self._real_connect(addr, False)
File "/usr/lib/python2.7/ssl.py", line 811, in _real_connect
socket.connect(self, addr)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
gaierror: [Errno -2] Name or service not known

I don't like it when people don't try to help themselves but I will refrain and await instructions from here on out.

from alertr.

rlefever avatar rlefever commented on May 29, 2024

Been trying to learn from http://serverfault.com/questions/9708/what-is-a-pem-file-and-how-does-it-differ-from-other-openssl-generated-key-file

should the caFile be the .crt or the csr?

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

Hi,

this comes because your given host name that is used to connect to the
server is not known. Seems your hostname "alertr-server.lefever.local"
does not exist. Please use the IP address, set up DNS or edit the
/etc/hosts for it.

I will back down a little bit from the project since I am now working
for over two years on it in my free time (and at the moment I am feeling
a little bit dull when it comes to it ... and since it is my hobby it
should not be). So I do not know how regular I will answer questions in
the next time. Please try to get it working with the configuration
examples for version 0.3 in the wiki (which is honestly very bad) or
wait until I wrote a step by step tutorial. Since the errors you had
encountered so far were because of mis-configurations (despite the
startup race condition with the mysql server), it should be doable with
with the commented configuration template.

If everything is working on your end, you could contribute tutorials for
other users. This way, they do not get the same problems that you
currently have.

Cheers,

sqall

On 16.06.2016 18:42, rlefever wrote:

Changed them back and rebooted.

Disabled unixsocket in managerClientDatabase/config/config.xml and /var/www/alertr/config/config.php

Currently getting the following in ~/managerClientDatabase/all.log

06/16/2016 12:38:48 ERROR: [client.pyc]: Connecting to server failed.
Traceback (most recent call last):
File "/home/pi/managerClientDatabase/lib/client.py", line 2315, in initializeCommunication
self.client.connect()
File "/home/pi/managerClientDatabase/lib/client.py", line 54, in connect
self.sslSocket.connect((self.host, self.port))
File "/usr/lib/python2.7/ssl.py", line 824, in connect
self._real_connect(addr, False)
File "/usr/lib/python2.7/ssl.py", line 811, in _real_connect
socket.connect(self, addr)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
gaierror: [Errno -2] Name or service not known

I don't like it when people don't try to help themselves but I will refrain and await instructions from here on out.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#15 (comment)

Andre Pawlowski


How everything you ever love will reject you or die.
Everything you ever create will be thrown away.
Everything you're proud of will end up as trash.
-Fight Club (Narrator)

from alertr.

rlefever avatar rlefever commented on May 29, 2024

Sorry to hear it has become dull. Life is too short for dull.

I have a couple of last questions if you would be so kind.

  1. You reference terminaling in. Please elaborate as to how.
  2. I have the web interface up and a Ping sensor running. The web interface shows 'Offline', a 1969 date and no sensors. How do I get it 'online'?

I appreciate all your help and will post my notes once I clean them up.

Thanks again.

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024
  1. You reference terminaling in. Please elaborate as to how.

Where do I reference it? Do you mean when I say "Use the terminal"? With this I mean the Linux Console/Terminal/TTY or whatever you want to call it.

  1. I have the web interface up and a Ping sensor running. The web interface shows 'Offline', a 1969 date and no sensors. How do I get it 'online'?

I would suggest you install the managerClientConsole first and check if everything is working. The configuration should be straight forward. Only set up all the credentials for the client (like for the other clients) and the "special" settings for it only concern the layout of the GUI.

The webinterface fetches the data directly from the MySQL database. The socket is only used as a back channel if you want to activate/deactivate the alertR system. The date shows that there is no actual data in the database (this, or something else is wrong when accessing the database). Because of this, it says it is offline.

from alertr.

rlefever avatar rlefever commented on May 29, 2024

I hate to sound dense but I do not yet understand.

I can ssh into the pi but how am I to "terminal" into the alertr system to
see what alertr is doing?

I do not see a managerClientConsole in the examples.

Thanks again for your time and assistance.

  1. You reference terminaling in. Please elaborate as to how.
    Where do I reference it? Do you mean when I say "Use the terminal"? With
    this I mean the Linux Console/Terminal/TTY or whatever you want to call
    it.
  2. I have the web interface up and a Ping sensor running. The web
    interface shows 'Offline', a 1969 date and no sensors. How do I get it
    'online'?
    I would suggest you install the managerClientConsole first and check if
    everything is working. The configuration should be straight forward. Only
    set up all the credentials for the client (like for the other clients) and
    the "special" settings for it only concern the layout of the GUI.

The webinterface fetches the data directly from the MySQL database. The
socket is only used as a back channel if you want to activate/deactivate
the alertR system. The date shows that there is no actual data in the
database (this, or something else is wrong when accessing the database).
Because of this, it says it is offline.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#15 (comment)

from alertr.

rlefever avatar rlefever commented on May 29, 2024

I got the managerClientConsole configured pulling from other instructions

###############################################
########## managerClientConsole ###############

pi@raspberrypi:/home/pi$ sudo su

Prereq

root@raspberrypi:/home/pi# pip install urwid

Create a password disabled user for server to run as (if needed)

root@raspberrypi:/home/pi# adduser --disabled-password alertr

change to that user

root@raspberrypi:/home/pi# su alertr

Create a folder to put it in

alertr@raspberrypi:/home/pi$ cd ~
alertr@raspberrypi:~$ mkdir managerClientConsole

Retrieve installer (no need to download the whole thing. The installer gets what it needs

alertr@raspberrypi:~$ wget https://raw.githubusercontent.com/sqall01/alertR/master/alertRinstaller.py

Install maanagerClientConsole

alertr@raspberrypi:~$ python alertRinstaller.py -i managerClientConsole -t managerClientConsole/

Configure

alertr@raspberrypi:~$ cp ~/managerClientConsole/config/config.xml.template ~/managerClientConsole/config/config.xml

alert@raspberrypi:~$ vim ~/managerClientConsole/config/config.xml

This is what I was expecting when you said "Terminal" into the server. Thanks.

I was able to activate the server thru the console but the web manager still says offline. I assume I have another problem with my config.

Edit: As expected it was a credentials mis-config. Got it working. Thanks so much for your help.

from alertr.

sqall01 avatar sqall01 commented on May 29, 2024

Ah great. Thanks for your notes and sorry for my absence. I will make use of them when I will write tutorials to make the life for all users easier.

from alertr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.