In most cases you will use your browser to retrieve the information you need. There may be situations where you want to process the data with other tools to create wiki entries, send mails and so on. Together with the information on the CGI parameters you can call the CGIs from the command line.
Before actually calling the CGIs you have to set three environment variables:
This variable is set to the user which has permission to retrieve the information. In most cases this will be "icingaadmin"
set REQUEST_METHOD='GET'. Possible values are "GET", "POST" and "HEAD"
Instead of passing arguments to the CGIs via the command line you have to set the variable "QUERY_STRING" with the appropriate values.
Most people find it difficult to read HTML output so it may be a good idea to add "jsonoutput" or "csvoutput" to this
If you forgot to set the environment variables you'll receive the following lines:
$> ./status.cgi getcgivars(): Unsupported REQUEST_METHOD -> '' I'm guessing you're trying to execute the CGI from a command line. In order to do that, you need to set the REQUEST_METHOD environment variable to either "GET", "HEAD", or "POST". When using the GET and HEAD methods, arguments can be passed to the CGI by setting the "QUERY_STRING" environment variable. If you're using the POST method, data is read from standard input. Also of note: if you've enabled authentication in the CGIs, you must set the "REMOTE_USER" environment variable to be the name of the user you're "authenticated" as.
The CGIs are called from within the folder which contains the *.cgi files (e.g.
$> set QUERY_STRING='jsonoutput' $> ./tac.cgi
All hosts in DOWN state
$> set QUERY_STRING='jsonoutput&style=hostdetail&hoststatustypes=4' $> ./status.cgi
All hosts in DOWN state being unacknowledged and not in a downtime
$> set QUERY_STRING='jsonoutput&style=hostdetail&hoststatustypes=4&hostprops=10' $> ./status.cgi
All service in non-OK state
$> set QUERY_STRING='jsonoutput&style=detail&servicestatustypes=28' $> ./status.cgi
All services being in CRITICAL state and being passive checks
$> set QUERY_STRING='jsonoutput&style=detail&servicestatustypes=28&serviceprops=65536' $> ./status.cgi
Comments for all objects
$> set QUERY_STRING='jsonoutput&type=3' $> ./extinfo.cgi
Trends for router_02 specifying a custom timeperiod using unix timestamps
$> set QUERY_STRING='jsonoutput&host=router_02&timeperiod=custom&t1=130748400&t2=1307570400' $> ./extinfo.cgi
Trends for router_02 specifying a custom timeperiod using date and time
$> set QUERY_STRING='jsonoutput&host=router_02&timeperiod=custom\ &sday=6&smon=6&syear=2011&shour=0&smin=0&ssec=0\ &eday=7&emon=6&eyear=2011&ehour=0&emin=0&esec=0' $> ./extinfo.cgi
(to be continued)
© 2009-2013 Icinga Development Team, http://www.icinga.org