Page 1 of 1

Cannot Delete Downtime by Hostname from CGI

Posted: Tue May 17, 2016 5:04 am
by vivekm
Hi

I am using Nagios core 4.x and I can Schedule a downtime for a host using CGI cmd_type=55.

But when I am trying to delete the downtime for a host using following curl cmd it is not working:

Code: Select all

curl --silent --show-error  --data cmd_typ=170 --data cmd_mod=2 --data host=myhostname  --data btnSubmit=Commit --insecure http://localhost:80/nagios/cgi-bin/cmd.cgi -u "nagiosadmin:xxxxxxx"
DEL_DOWNTIME_BY_HOST_NAME = 170

The cgi is returning an error "Sorry, but you are not authorized to commit the specified command."


am i missing any argument? The command DEL_DOWNTIME_BY_HOST_NAME works from shell script thought but i want to work it through CGI.

Is there also a way to find downtime_id of a host from CGI so then i can use cmd_type=78 which uses a downtime id?

Re: Cannot Delete Downtime by Hostname from CGI

Posted: Tue May 17, 2016 2:08 pm
by bwallace
I'm curious about permissions for the following. Could you post the output of these commands?

Code: Select all

ls -la /usr/local/nagios/var/rw/nagios.cmd
ls -la /usr/local/nagios/var/rw/
Also, could you look in /etc/group and note what users are a part of group 'nagioscmd'
Here is what mine looks like, albeit form a very vanilla test set up:
nagioscmd:x:119:nagios,www-data

Re: Cannot Delete Downtime by Hostname from CGI

Posted: Wed May 18, 2016 5:44 am
by vivekm
Hello,

Following is output of your cmds on my nagios Server

Code: Select all

vagrant@vagrant-ubuntu-trusty-64:~/tmp$ ls -la /usr/local/nagios/var/rw/nagios.cmd
prw-rw---- 1 nagios nagcmd 0 May 18 10:33 /usr/local/nagios/var/rw/nagios.cmd
vagrant@vagrant-ubuntu-trusty-64:~/tmp$ ls -la /usr/local/nagios/var/rw/
total 8
drwxrwsr-x 2 nagios nagcmd 4096 May 18 10:21 .
drwxrwxr-x 5 nagios nagios 4096 May 18 10:42 ..
prw-rw---- 1 nagios nagcmd    0 May 18 10:33 nagios.cmd
srw-rw---- 1 nagios nagcmd    0 May 18 10:21 nagios.qh

in /etc/group

Code: Select all

nagcmd:x:1003:nagios,www-data

Re: Cannot Delete Downtime by Hostname from CGI

Posted: Wed May 18, 2016 4:26 pm
by tmcdonald
Can you please specify the exact Core version you are using? There were several releases in the 4.X branch.