consistent start-stop script to nagiosxi after upgrade 5.5.1

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
junkertf
Posts: 119
Joined: Tue Aug 08, 2017 1:52 am

Re: consistent start-stop script to nagiosxi after upgrade 5

Post by junkertf »

Hello,

I send you the sudoers in PM, and the asked outputs here below (same output both UAT and PROD host)

[root@nagios ~]# grep nag /etc/group
nagios:x:5500:nagios,apache,snmptt
nagcmd:x:16662:nagios,apache,snmptt
[root@nagios ~]# chage -l nagios
Last password change : Apr 18, 2018
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
[root@nagios ~]# grep "User\|Group" /etc/httpd/conf/httpd.conf
# User/Group: The name (or #number) of the user/group to run httpd as.
User apache
Group apache
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

And the answer is yes, to both question.
- The users of our xi system authenticated from AD/LDAP
- The XI System Component Status is shows only that red status, and actually also the System status "led" on the top rigth corner....
(And after i click on the start button at its right it shows green as started)


thanks,

Ferenc
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: consistent start-stop script to nagiosxi after upgrade 5

Post by ssax »

Please send the script you are using so that I can look at it.
junkertf
Posts: 119
Joined: Tue Aug 08, 2017 1:52 am

Re: consistent start-stop script to nagiosxi after upgrade 5

Post by junkertf »

Hello,

As i wrote in my first post.... :)

[root@nagios client]# cat /root/nagiosxi_full_stop.sh
#!/bin/bash
service nagiosxi stop
sleep 3
service npcd stop
sleep 3
service ndo2db stop
sleep 3
service nagios stop
sleep 3
#service postgresql stop
service mariadb stop
sleep 3
service httpd stop
You have new mail in /var/spool/mail/root

[root@nagios client]# cat /root/nagiosxi_full_start.sh
#!/bin/bash
service httpd start
sleep 15
service mariadb start
sleep 15
#service postgresql start
service nagios start
sleep 15
service ndo2db start
sleep 15
service npcd start
sleep 15
service nagiosxi start


Thanks, Best regards,

Ferenc
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: consistent start-stop script to nagiosxi after upgrade 5

Post by ssax »

You have the order reverse on ndo2db and nagios which can cause issues, please use these:
- Additionally, nagiosxi service is basically not used (it's commented out inside)

Code: Select all

#!/bin/bash
service npcd stop
sleep 3
service nagios stop
sleep 3
service ndo2db stop
sleep 3
#service postgresql stop
service mariadb stop
sleep 3
service httpd stop

Code: Select all

#!/bin/bash
service httpd start
sleep 15
service mariadb start
sleep 15
#service postgresql start
service ndo2db start
sleep 15
service nagios start
sleep 15
service npcd start
Let us know if that resolves the issue for you.
junkertf
Posts: 119
Joined: Tue Aug 08, 2017 1:52 am

Re: consistent start-stop script to nagiosxi after upgrade 5

Post by junkertf »

Hello,

Sorry for a bit late...
Nope, same situation.. But i have the popup errors for the red statuses.
I had attached it, maybe it will help...

Thanks, best regards,

Ferenc
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: consistent start-stop script to nagiosxi after upgrade 5

Post by ssax »

So you run the shutdown, then you run the startup and nagios and npcd don't get started?

Are you running the script manually and then they don't start properly? Are you getting any errors when you run them? Are you running them as root?

It may take a couple minutes for that widget to update.
junkertf
Posts: 119
Joined: Tue Aug 08, 2017 1:52 am

Re: consistent start-stop script to nagiosxi after upgrade 5

Post by junkertf »

Hello,

Using script file for shutdown/startup as you've send me...
the output with dates...

[root@nagios ~]# date; /root/nagiosxi_full_stop.sh; date
Wed Aug 29 08:06:35 CEST 2018
NPCD Stopped.
Stopping nagios: .done.
Stopping ndo2db (via systemctl): [ OK ]
Redirecting to /bin/systemctl stop mariadb.service
Redirecting to /bin/systemctl stop httpd.service
Wed Aug 29 08:07:13 CEST 2018
[root@nagios ~]# service npcd status
NPCD not running.
[root@nagios ~]# ipcs -q

------ Message Queues --------
key msqid owner perms used-bytes messages

[root@nagios ~]# date; /root/nagiosxi_full_start.sh; date
Wed Aug 29 08:08:06 CEST 2018
Redirecting to /bin/systemctl start httpd.service
Redirecting to /bin/systemctl start mariadb.service
Starting ndo2db (via systemctl): [ OK ]
Starting nagios: done.
NPCD started.
Wed Aug 29 08:19:09 CEST 2018
[root@nagios ~]# service npcd status
NPCD running (pid 25368).

i waited 10 minutes after the last service start to log in, and the status is still red


thanks, best regards,

Ferenc
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: consistent start-stop script to nagiosxi after upgrade 5

Post by ssax »

I think I see the issue, please use these as your scripts, it should make it work properly:

Code: Select all

#!/bin/bash
systemctl stop npcd
sleep 3
systemctl stop nagios
sleep 3
systemctl stop ndo2db
sleep 3
#systemctl stop postgresql
systemctl stop mariadb
sleep 3
systemctl stop httpd

Code: Select all

#!/bin/bash
systemctl start httpd
sleep 15
systemctl start mariadb
sleep 15
#systemctl start postgresql
systemctl start ndo2db
sleep 15
systemctl start nagios
sleep 15
systemctl start npcd
Let us know the results.
junkertf
Posts: 119
Joined: Tue Aug 08, 2017 1:52 am

Re: consistent start-stop script to nagiosxi after upgrade 5

Post by junkertf »

Hello,

Thank you for the assist, the solution is working well, the case can be closed!


Best regards,

Ferenc
Locked