Nagios does not update status in the UI

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

Re: Nagios does not update status in the UI

Post by linuser »

hsmith wrote:Quick example script. It's pretty hack-y, but hey, it does the thing.

Code: Select all

#!/bin/bash



S1="active"


Info=$(systemctl status $1 | awk 'NR==3' | awk '{print $2}')



if [ $Info == $S1 ]

then

        echo "yay" $1 "is running!"

        exit 0

else
        echo "boooo" $1 "is not running!"

        exit 3
fi
Ok. That did the trick. The only thing is if the service is down Nagios recognizes it as "Unknown/Amber" and not "Critical/Red". But yea I think that's good enough for now! 8-) Lets leave this thread open in-case anyone else has any suggestions or insights. Thanks so much for the help!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Nagios does not update status in the UI

Post by hsmith »

Have it exit with 2 instead of 3. Oops.

0 = Good
1 = Warning
2 = Critical
3 = Unknown
Former Nagios Employee.
me.
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

Re: Nagios does not update status in the UI

Post by linuser »

Yep. Awesome man thanks again! We can close this out.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios does not update status in the UI

Post by rkennedy »

Glad to see this worked out! I will now close this thread, but feel free to open another in the future if you need more assistance.
Former Nagios Employee
Locked