Cannot Delete Downtime by Hostname from CGI

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.
Locked
vivekm
Posts: 4
Joined: Tue May 17, 2016 4:19 am

Cannot Delete Downtime by Hostname from CGI

Post 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?
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Cannot Delete Downtime by Hostname from CGI

Post 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
Be sure to check out the Knowledgebase for helpful articles and solutions!
vivekm
Posts: 4
Joined: Tue May 17, 2016 4:19 am

Re: Cannot Delete Downtime by Hostname from CGI

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Cannot Delete Downtime by Hostname from CGI

Post by tmcdonald »

Can you please specify the exact Core version you are using? There were several releases in the 4.X branch.
Former Nagios employee
Locked