NNA System Backup (Backup in progress...)

This board serves as an open discussion and support collaboration point for Nagios Network Analyzer

NNA System Backup (Backup in progress...)

Postby FoUStep » Fri Nov 29, 2019 5:16 am

Hi,

I've installed NNA manually on Ubuntu 18.04 and it works almost out of the box without any issues. There is one slight issue at hand and that is creating a backup through the GUI does not work. It stays on "Backup in progress..." even after rebooting, restarting nagiosna or apache2.

Through CLI it works without problems with the na_backup.sh script.

/var/log/messages does not show any useful information regarding creating a backup through the web interface.

I figured it could be a PHP thingy or a permissions issue but I am not sure, is there anyone who can point me in the right direction? The permissions look okay (the folder /store/backup/nagiosna is writable for user nna and group nnacmd and I have confirmed the user nna is in the nnacmd group and so is www-data).

Thanks,
Step
Last edited by FoUStep on Mon Dec 09, 2019 2:59 am, edited 1 time in total.
FoUStep
 
Posts: 13
Joined: Wed Apr 06, 2016 9:23 am

Re: NNA System Backup (Backup in progress...)

Postby benjaminsmith » Mon Dec 02, 2019 3:05 pm

Hello Step,

If the cron service is not running on the server, it may not process the backup job and that status wouldn't clear.
Code: Select all
systemctl status crond
## To START
systemctl start crond

If that's not the cause, please post the Apache and NNA logs to the thread for us to review. Thanks.
Code: Select all
tail -n 50 /var/log/httpd/*error_log
tail -n 50 /usr/local/nagiosna/var/cmdsubsys.log
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benjaminsmith
 
Posts: 2075
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: NNA System Backup (Backup in progress...)

Postby FoUStep » Tue Dec 03, 2019 5:49 am

Hello Benjamin,

I've checked the following on Ubuntu 18.04:
root@NNA:/home# systemctl status crond
Unit crond.service could not be found.


Cron is installed and "crontab -e" shows no (existing) lines of possible code to execute.

tail from the error log in apache2:
root@NNA:/home/# tail -n 50 /var/log/apache2/*error.log
[Tue Dec 03 06:25:01.949660 2019] [ssl:warn] [pid 699] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Tue Dec 03 06:25:01.949861 2019] [mpm_prefork:notice] [pid 699] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 configured -- resuming normal operations
[Tue Dec 03 06:25:01.949869 2019] [core:notice] [pid 699] AH00094: Command line: '/usr/sbin/apache2


The cmdsubsys.log does not exist. The location folder does exist but only has a backend.log which seems to be working well.
FoUStep
 
Posts: 13
Joined: Wed Apr 06, 2016 9:23 am

Re: NNA System Backup (Backup in progress...)

Postby benjaminsmith » Tue Dec 03, 2019 3:38 pm

Hello @FoUStep,

It looks like the commands are slightly different for an Ubuntu system. You should be able to check the cron status with the following command:
Code: Select all
service cron status

To restart:
Code: Select all
service cron restart

Are you able to view the status results on this page?
Code: Select all
http://<nna server address>/nagiosna/api/system/backup_cron_status

Lastly, you can view the cronjobs in the logfile by running:
Code: Select all
grep CRON /var/log/syslog
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benjaminsmith
 
Posts: 2075
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: NNA System Backup (Backup in progress...)

Postby FoUStep » Wed Dec 04, 2019 4:43 am

See below for the requested results.

Code: Select all
service cron status

root@NNA1:/home# service cron status
● cron.service - Regular background program processing daemon
Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-11-27 14:29:12 CET; 6 days ago
Docs: man:cron(8)
Main PID: 929 (cron)
Tasks: 1 (limit: 1095)
CGroup: /system.slice/cron.service
└─929 /usr/sbin/cron -f

Dec 04 10:25:01 NNA1 CRON[14073]: pam_unix(cron:session): session closed for user root
Dec 04 10:35:01 NNA1 CRON[15272]: pam_unix(cron:session): session opened for user root by (uid=0)
Dec 04 10:35:01 NNA1 CRON[15273]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Dec 04 10:35:01 NNA1 CRON[15272]: pam_unix(cron:session): session closed for user root
Dec 04 10:39:01 NNA1 CRON[15711]: pam_unix(cron:session): session opened for user root by (uid=0)
Dec 04 10:39:01 NNA1 CRON[15712]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 04 10:39:01 NNA1 CRON[15711]: pam_unix(cron:session): session closed for user root
Dec 04 10:40:01 NNA1 CRON[16076]: pam_unix(cron:session): session opened for user smmsp by (uid=0)
Dec 04 10:40:01 NNA1 CRON[16077]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
Dec 04 10:40:01 NNA1 CRON[16076]: pam_unix(cron:session): session closed for user smmsp


Code: Select all
service cron restart

Dec 04 10:42:48 NNA1 systemd[1]: Started Regular background program processing daemon.
Dec 04 10:42:48 NNA1 cron[16336]: (CRON) INFO (pidfile fd = 3)
Dec 04 10:42:48 NNA1 cron[16336]: (*system*nagiosna) ERROR (Missing newline before EOF, this crontab file will be ignored)
Dec 04 10:42:48 NNA1 cron[16336]: (CRON) INFO (Skipping @reboot jobs -- not system startup)


Code: Select all
http://<nna server address>/nagiosna/api/system/backup_cron_status

{"status":5}


Code: Select all
grep CRON /var/log/syslog

Dec 4 10:25:01 NNA1 CRON[14074]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Dec 4 10:35:01 NNA1 CRON[15273]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Dec 4 10:39:01 NNA1 CRON[15712]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 4 10:40:01 NNA1 CRON[16077]: (smmsp) CMD (test -x /etc/init.d/sendmail && test -x /usr/share/sendmail/sendmail && test -x /usr/lib/sm.bin/sendmail && /usr/share/sendmail/sendmail cron-msp)
FoUStep
 
Posts: 13
Joined: Wed Apr 06, 2016 9:23 am

Re: NNA System Backup (Backup in progress...)

Postby benjaminsmith » Wed Dec 04, 2019 11:36 am

Hello,

Thanks for posting the output from the commands, it looks like this is the issue.
Dec 04 10:42:48 NNA1 cron[16336]: (CRON) INFO (pidfile fd = 3)
Dec 04 10:42:48 NNA1 cron[16336]: (*system*nagiosna) ERROR (Missing newline before EOF, this crontab file will be ignored)

Add a new line at the end of the file and then restart the cron service. Here's the path to the file:
Code: Select all
/etc/cron.d/nagisona

Once this is corrected it should process the backups and the status will clear.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benjaminsmith
 
Posts: 2075
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: NNA System Backup (Backup in progress...)

Postby FoUStep » Thu Dec 05, 2019 9:23 am

benjaminsmith wrote:Hello,

Thanks for posting the output from the commands, it looks like this is the issue.
Dec 04 10:42:48 NNA1 cron[16336]: (CRON) INFO (pidfile fd = 3)
Dec 04 10:42:48 NNA1 cron[16336]: (*system*nagiosna) ERROR (Missing newline before EOF, this crontab file will be ignored)

Add a new line at the end of the file and then restart the cron service. Here's the path to the file:
Code: Select all
/etc/cron.d/nagisona

Once this is corrected it should process the backups and the status will clear.


Thank you Benjamin for this insight in the working of the system (the correct path is: /etc/cron.d/nagiosna). There was indeed no newline in the cron job. I've added a newline to the following:
# /etc/cron.d/nagiosna: crontab fragment for nagiosna

* * * * * nna /usr/bin/php -q /var/www/html/nagiosna/www/index.php cmdsubsys > /usr/local/nagiosna/var/cmdsubsys.log 2>&1
0 * * * * nna /usr/bin/php -q /var/www/html/nagiosna/www/index.php cache > /usr/local/nagiosna/var/cache.log 2>&1
#<newlinehere>


Restart cron, apache2 and nagiosna, this did not give me any immediate result. A reboot seems to have started something and it took a while (I clicked multiple times so it makes multiple backups) but it appears to be doing something.

Code: Select all
ps aux

nna 5152 0.0 0.0 4624 884 ? Ss 15:19 0:00 /bin/sh -c /usr/bin/php -q /var/www/html/nagiosna/www/index.php cmdsubsys > /usr/local/nagiosna/var/cmdsubsys.log 2>&1
nna 5153 0.2 2.5 256516 25332 ? S 15:19 0:00 /usr/bin/php -q /var/www/html/nagiosna/www/index.php cmdsubsys


Code: Select all
cat /usr/local/nagiosna/var/cmdsubsys.log

..................................Finished running commands.


Apparently the above keeps repeating itself (the process keeps respawning), at first I thought it was because I have pressed the Backup Button multiple times. But now the backups seems to be completed but the status still has not changed.

Creating a backup through the web interface now works, however the status does not change due to the spawning process.


Regardless of the problem:
Any idea why there is no newline added to the cron job by default using Ubuntu 18.04? Perhaps there's a way to build an extra check into the system to check for the newline?
FoUStep
 
Posts: 13
Joined: Wed Apr 06, 2016 9:23 am

Re: NNA System Backup (Backup in progress...)

Postby benjaminsmith » Thu Dec 05, 2019 10:31 am

Hello @FoUStep,

Not sure why there was a change to the crontab file. I tested this any Ubuntu 18.04 and was not able to re-create the problem. How long has the issue been present and did anyone edit the file recently?

Ruu the following SQL query to clear the backup status and let me know if the issue is resolved now.
Code: Select all
echo "UPDATE nagiosna_cmdsubsys SET processing = 0, completed = 1 WHERE command = 1002;" | mysql -h 127.0.0.1 -unagiosna -pnagiosna nagiosna
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benjaminsmith
 
Posts: 2075
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: NNA System Backup (Backup in progress...)

Postby FoUStep » Mon Dec 09, 2019 2:59 am

benjaminsmith wrote:Hello @FoUStep,

Not sure why there was a change to the crontab file. I tested this any Ubuntu 18.04 and was not able to re-create the problem. How long has the issue been present and did anyone edit the file recently?

Ruu the following SQL query to clear the backup status and let me know if the issue is resolved now.
Code: Select all
echo "UPDATE nagiosna_cmdsubsys SET processing = 0, completed = 1 WHERE command = 1002;" | mysql -h 127.0.0.1 -unagiosna -pnagiosna nagiosna


:!: This worked! After the running the code I initiated a backup sequence through the web interface and when it was done, the status cleared.

Thank you Benjamin for the guidance and help solving the problem.
FoUStep
 
Posts: 13
Joined: Wed Apr 06, 2016 9:23 am

Re: NNA System Backup (Backup in progress...)

Postby benjaminsmith » Mon Dec 09, 2019 1:06 pm

Hello,
Thank you Benjamin for the guidance and help solving the problem.

Happy to hear that took care of it! I'll go ahead and lock this post, but if you have any new questions, feel free to open another.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benjaminsmith
 
Posts: 2075
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul


Return to Nagios Network Analyzer

Who is online

Users browsing this forum: No registered users and 1 guest