Page 1 of 2

Trying to Scheduled Host Downtime

Posted: Fri Dec 06, 2019 12:35 pm
by Alan
I am trying to schedule downtime and I am getting errors. I have tried it from two places, one is under system/downtown and the other place was just under the host. These are the errors I get for each place:

From - System/Downtime

Sorry, but you are not authorized to commit the specified command. Read the section of the documentation that deals with authentication and authorization in the CGIs for more information.

From - the Host it self

Code: Select all

Could not stat() command file '/usr/local/nagios/var/rw/nagios.cmd'!

The external command file may be missing, Nagios may not be running, and/or Nagios may not be checking external commands.

An error occurred while attempting to commit your command for processing.
I am not sure what else to try.

I did find a form that said to run this but is did not work:

Code: Select all

usermod -G nagios nagios
usermod -G nagcmd apache
service nagios restart
service httpd restart

Re: Trying to Scheduled Host Downtime

Posted: Fri Dec 06, 2019 1:16 pm
by Alan
I found a post that said run

Code: Select all

$ sudo setenforce 0
I am not sure if this is the best way to do it but it does work. I this the way I should do it or is there a better way?

Re: Trying to Scheduled Host Downtime

Posted: Fri Dec 06, 2019 3:42 pm
by scottwilkerson
Can you show the output of the following

Code: Select all

getenforce
grep nag /etc/group
ls -al /usr/local/nagios/var/rw

Re: Trying to Scheduled Host Downtime

Posted: Fri Dec 06, 2019 4:47 pm
by Alan
Here it is:

Code: Select all

[alan@Svr-Monitor objects]$ getenforce
Permissive
[alan@Svr-Monitor objects]$ grep nag /etc/group
nagios:x:1001:nagios
nagcmd:x:1002:apache
[alan@Svr-Monitor objects]$ ls -al /usr/local/nagios/var/rw
total 0
drwxrwsr-x. 2 nagios nagcmd  41 Dec  6 13:29 .
drwxrwxr-x. 5 nagios nagios 191 Dec  6 13:39 ..
prw-rw----. 1 nagios nagcmd   0 Dec  6 07:28 nagios.cmd
srw-rw----. 1 nagios nagcmd   0 Dec  6 13:29 nagios.qh
[alan@Svr-Monitor objects]$ 

Re: Trying to Scheduled Host Downtime

Posted: Fri Dec 06, 2019 4:58 pm
by scottwilkerson
Is your user listed as authorized_for_system_commands in /usr/local/nagios/etc/cgi.cfg?

Re: Trying to Scheduled Host Downtime

Posted: Fri Dec 06, 2019 5:22 pm
by Alan
Ya I have: authorized_for_system_commands=nagiosadmin
This is the user I am logging into the GUI as.

Re: Trying to Scheduled Host Downtime

Posted: Fri Dec 06, 2019 5:58 pm
by ssax
Please change your /etc/group entries for these:

Code: Select all

nagios:x:1001:nagios
nagcmd:x:1002:apache
To these:

Code: Select all

nagios:x:1001:apache,nagios
nagcmd:x:1002:apache,nagios
Then restart the services and try again:

Code: Select all

service httpd restart
service nagios restart

Re: Trying to Scheduled Host Downtime

Posted: Fri Dec 06, 2019 6:28 pm
by Alan
Sorry I am not really sure how to change that?

Re: Trying to Scheduled Host Downtime

Posted: Mon Dec 09, 2019 2:47 pm
by lmiltchev
Open the "/etc/group" file in a text editor, for example "vi" or "nano", and change this:

Code: Select all

nagios:x:1001:nagios
nagcmd:x:1002:apache
to this:

Code: Select all

nagios:x:1001:apache,nagios
nagcmd:x:1002:apache,nagios
save, exit, and restart apache:

Code: Select all

service httpd restart
Let us know if this helped.

Re: Trying to Scheduled Host Downtime

Posted: Wed Dec 11, 2019 12:13 pm
by Alan
Thank you that worked like a charm. I do have one more question about downtime. How do I create child host? I am trying to schedule downtime for many hosts at once. I found a post that said if you want to do this you choose schedule triggered downtime for all child hosts. I am not sure how to get child hosts though. I have researched and have not found away to do this. I attached a screen shot of the section I am referring to.