Scheduled Downtime not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
RyanMule
Posts: 57
Joined: Tue Dec 12, 2017 3:14 pm

Re: Scheduled Downtime not working

Post by RyanMule »

ssax wrote:Are you using SNMP Traps by chance? If so, can you please attach this file:

Code: Select all

/usr/local/bin/snmptraphandling.py
You will need to run these commands again:

Code: Select all

service nagios stop
killall -9 nagios
rm -f /usr/local/nagios/var/rw/nagios.cmd
service nagios start
Here is your output (notice the missing p on the begging showing it's a pipe file):

Code: Select all

[root@nagios02 ~]# ls -al /usr/local/nagios/var/rw/nagios.cmd
-rw-rw-r-- 1 root nagcmd 178 Oct 3 15:44 /usr/local/nagios/var/rw/nagios.cmd
Here is a proper output (notice the first p on the permissions indicating it is a pipe file):

Code: Select all

[root@xid mysql]# ls -l /usr/local/nagios/var/rw/nagios.cmd
prw-rw---- 1 nagios nagcmd 0 Oct  3 15:32 /usr/local/nagios/var/rw/nagios.cmd

Hello ssax,

Thank you for your input.

Yes we are using a few SNMP traps. I have attached the requested file.

I reran the following commands and believe I am receiving the proper output now

[root@nagios02 ~]# service nagios stop
Stopping nagios:. done.
[root@nagios02 ~]# killall -9 nagios
nagios: no process killed
[root@nagios02 ~]# rm -f /usr/local/nagios/var/rw/nagios.cmd
[root@nagios02 ~]# service nagios start
Starting nagios: done.
[root@nagios02 ~]# ls -al /usr/local/nagios/var/rw/nagios.cmd
prw-rw---- 1 nagios nagcmd 0 Oct 4 11:36 /usr/local/nagios/var/rw/nagios.cmd
[root@nagios02 ~]# ^C
[root@nagios02 ~]#

Schedule downtime through the UI is working now!!!

I don't know how the pipe tag would have been dropped but that appears to be the issue.
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: Scheduled Downtime not working

Post by ssax »

Yep, that's the issue. So if you run this command on your system you will see that it doesn't return anything:

Code: Select all

grep ISFIFO /usr/local/bin/snmptraphandling.py
Please run these commands to fix the issue:

Code: Select all

cd /tmp
wget https://assets.nagios.com/downloads/nagiosxi/scripts/NagiosXI-SNMPTrap-setup.sh
sh ./NagiosXI-SNMPTrap-setup.sh
Now if you run this command you will see that it does return the line (which happens to make sure the file is a FIFO before writing):

Code: Select all

[root@xid tmp]# grep ISFIFO /usr/local/bin/snmptraphandling.py
        if os.path.exists('/usr/local/nagios/var/rw/nagios.cmd') and stat.S_ISFIFO(os.stat('/usr/local/nagios/var/rw/nagios.cmd').st_mode):
RyanMule
Posts: 57
Joined: Tue Dec 12, 2017 3:14 pm

Re: Scheduled Downtime not working

Post by RyanMule »

I apologize but I am confused. This is related to the downtime issue?

Here is the output of the commands below

Thank you!

========================================
SNMP Trap Support Installation Complete!
========================================
[root@nagios02 tmp]# grep ISFIFO /usr/local/bin/snmptraphandling.py
if os.path.exists('/usr/local/nagios/var/rw/nagios.cmd') and stat.S_ISFIFO(os.stat('/usr/local/nagios/var/rw/nagios.cmd').st_mode):


ssax wrote:Yep, that's the issue. So if you run this command on your system you will see that it doesn't return anything:

Code: Select all

grep ISFIFO /usr/local/bin/snmptraphandling.py
Please run these commands to fix the issue:

Code: Select all

cd /tmp
wget https://assets.nagios.com/downloads/nagiosxi/scripts/NagiosXI-SNMPTrap-setup.sh
sh ./NagiosXI-SNMPTrap-setup.sh
Now if you run this command you will see that it does return the line (which happens to make sure the file is a FIFO before writing):

Code: Select all

[root@xid tmp]# grep ISFIFO /usr/local/bin/snmptraphandling.py
        if os.path.exists('/usr/local/nagios/var/rw/nagios.cmd') and stat.S_ISFIFO(os.stat('/usr/local/nagios/var/rw/nagios.cmd').st_mode):
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Scheduled Downtime not working

Post by scottwilkerson »

RyanMule wrote:I apologize but I am confused. This is related to the downtime issue?

Here is the output of the commands below
I know it sounds weird, but it is related, and here's why.

There was a bug in old versions of the snmptraphandling.py file which didn't check to make sure the file was a pipe before writing to it.

When this happened, if nagios was in the process of restarting it would actually create a nagios.cmd file and after nagios starts it could not create the nagios.cmd command pipe, which is required to submit commands such as downtime from the UI.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
RyanMule
Posts: 57
Joined: Tue Dec 12, 2017 3:14 pm

Re: Scheduled Downtime not working

Post by RyanMule »

Hey Scottwilkerson,

thank you for the explanation and help! You can lock this thread again if you wish. We are working!

Also thank you Ssax for the additional input!

scottwilkerson wrote:
RyanMule wrote:I apologize but I am confused. This is related to the downtime issue?

Here is the output of the commands below
I know it sounds weird, bu it is related, and here's why.

There was a bug in old versions of the snmptraphandling.py file which didn't check to make sure the file was a pipe before writing to it.

When this happened, if nagios was in the process of restarting it would actually create a nagios.cmd file and after nagios starts it could not create the nagios.cmd command pipe, which is required to submit commands such as downtime from the UI.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Scheduled Downtime not working

Post by scottwilkerson »

RyanMule wrote:Hey Scottwilkerson,

thank you for the explanation and help! You can lock this thread again if you wish. We are working!

Also thank you Ssax for the additional input!

scottwilkerson wrote:
RyanMule wrote:I apologize but I am confused. This is related to the downtime issue?

Here is the output of the commands below
I know it sounds weird, bu it is related, and here's why.

There was a bug in old versions of the snmptraphandling.py file which didn't check to make sure the file was a pipe before writing to it.

When this happened, if nagios was in the process of restarting it would actually create a nagios.cmd file and after nagios starts it could not create the nagios.cmd command pipe, which is required to submit commands such as downtime from the UI.
Great!

Locking
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked