CGI access via command line stopped working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jh129666
Posts: 98
Joined: Mon Feb 11, 2013 3:45 pm

CGI access via command line stopped working

Post by jh129666 »

We're getting the below error when trying to submit a command via the CGI interface. This worked at one point, but since it's not used a lot I'm not sure when it stopped working.

curl -u nagiosadmin:xxxxx -d "cmd_typ=68&cmd_mod=2&host=abc123&btnSubmit=Commit" http://123.45.67.89/nagios/cgi-bin/cmd.cgi


<P><DIV CLASS='errorMessage'>Sorry, but you are not authorized to commit the specified command.</DIV></P>
<P><DIV CLASS='errorDescription'>Read the section of the documentation that deals with authentication and authorization in the CGIs for more information.<BR><BR>
<A HREF='javascript:window.history.go(-2)'>Return from whence you came</A></DIV></P>

Moderator's Note: The profile has been removed from the public forum.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: CGI access via command line stopped working

Post by lmiltchev »

Command 68 is used to disable active checks of all services in a hostgroup. In your command you have a host specified instead... Your command should look something like this:
curl -u nagiosadmin:xxxxx -d "cmd_typ=68&cmd_mod=2&hostgroup=<hostgroup name>&btnSubmit=Commit" http://123.45.67.89/nagios/cgi-bin/cmd.cgi
Be sure to check out our Knowledgebase for helpful articles and solutions!
jh129666
Posts: 98
Joined: Mon Feb 11, 2013 3:45 pm

Re: CGI access via command line stopped working

Post by jh129666 »

I copied the wrong command (thanks for the correction), but the same error occurs for a hostgroup.

curl -u nagiosadmin:xxxxxx -d "cmd_typ=68&cmd_mod=2&hostgroup=all-hosts&btnSubmit=Commit" http://12.345.67.89/nagios/cgi-bin/cmd.cgi


<P><DIV CLASS='errorMessage'>Sorry, but you are not authorized to commit the specified command.</DIV></P>
<P><DIV CLASS='errorDescription'>Read the section of the documentation that deals with authentication and authorization in the CGIs for more information.<BR><BR>
<A HREF='javascript:window.history.go(-2)'>Return from whence you came</A></DIV></P>
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: CGI access via command line stopped working

Post by lmiltchev »

Is "all-hosts" a valid hostgroup? Is it activated? I have tested the command a numerous times, and it worked for me just fine.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jh129666
Posts: 98
Joined: Mon Feb 11, 2013 3:45 pm

Re: CGI access via command line stopped working

Post by jh129666 »

Yes, all-hosts is a valid hostgroup and it's active. This is just one example as nothing is working via the CGI command interface.
jh129666
Posts: 98
Joined: Mon Feb 11, 2013 3:45 pm

Re: CGI access via command line stopped working

Post by jh129666 »

This can be closed as we're going to open a ticket for the issue. Thanks!!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: CGI access via command line stopped working

Post by lmiltchev »

...nothing is working via the CGI command interface
This is strange. What is the curl version that you are currently using?

Code: Select all

curl -V
Does it make a difference when you pass "--basic" to your command?

Code: Select all

curl --basic -u nagiosadmin:xxxxx -d "cmd_typ=68&cmd_mod=2&hostgroup=all-hosts&btnSubmit=Commit" http://123.45.67.89/nagios/cgi-bin/cmd.cgi
Are you using SSL or a proxy? Is SELinux enabled?

Code: Select all

sestatus
Can you post the /etc/httpd/conf/httpd.conf and /etc/httpd/conf.modules.d/01-cgi.conf files on the forum?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked