Trying to Scheduled Host Downtime

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.
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Trying to Scheduled Host Downtime

Post 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
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: Trying to Scheduled Host Downtime

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Trying to Scheduled Host Downtime

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: Trying to Scheduled Host Downtime

Post 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]$ 
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Trying to Scheduled Host Downtime

Post by scottwilkerson »

Is your user listed as authorized_for_system_commands in /usr/local/nagios/etc/cgi.cfg?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: Trying to Scheduled Host Downtime

Post by Alan »

Ya I have: authorized_for_system_commands=nagiosadmin
This is the user I am logging into the GUI as.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Trying to Scheduled Host Downtime

Post 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
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: Trying to Scheduled Host Downtime

Post by Alan »

Sorry I am not really sure how to change that?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Trying to Scheduled Host Downtime

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Alan
Posts: 86
Joined: Wed Aug 21, 2019 4:14 pm

Re: Trying to Scheduled Host Downtime

Post 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.
Attachments
ChildHosts.png
Locked