How to create a new CGI and integrate it ?
Bouffanet, Fabrice
Fabrice.Bouffanet at getronics.com
Fri Jun 24 15:55:34 CEST 2005
Hello,
I want to add a new CGI into Nagios CGI.
This CGI need to get CGI parameters (host for example)
In order to get these variables, i'm trying to use a function process_cgivars.
This function looks like process_cgivars like in extinfo.c script.
The new function looks like :
int process_cgivars(void){
char **variables;
int error=FALSE;
int x;
variables=getcgivars();
for(x=0;variables[x]!=NULL;x++){
if(strlen(variables[x])>=MAX_INPUT_BUFFER-1){
x++;
continue;
}
else if(!strcmp(variables[x],"host")){
x++;
if(variables[x]==NULL){
error=TRUE;
break;
}
host_name=strdup(variables[x]);
if(host_name==NULL)
host_name="";
}
}
free_cgivars(variables);
return error;
}
I'm compiling this program with :
dpkg-buildpackage
and install the new version with :
dpkg -i nagios-mysql.deb
When i'm trying to display the page, i get the following page :
Nagios Process Information
Last Updated: Fri Jun 24 15:53:35 CEST 2005
Updated every 90 seconds
Nagios® - www.nagios.org
Logged in as nagiosadmin
Process Information
Program Start Time: 06-15-2005 15:36:01
Total Running Time: 9d 0h 17m 35s
Last External Command Check: 06-24-2005 15:53:31
Last Log File Rotation: 06-24-2005 00:00:00
Nagios PID 27323
Notifications Enabled? YES
Service Checks Being Executed? YES
Passive Service Checks Being Accepted? YES
Event Handlers Enabled? Yes
Obsessing Over Services? No
Flap Detection Enabled? No
Performance Data Being Processed? No
Process Commands
Shutdown the Nagios Process<http://192.168.222.45/nagios/images/stop.gif> Shutdown the Nagios process <http://192.168.222.45/nagios/cgi-bin/cmd.cgi?cmd_typ=14>
Restart the Nagios Process<http://192.168.222.45/nagios/images/restart.gif> Restart the Nagios process <http://192.168.222.45/nagios/cgi-bin/cmd.cgi?cmd_typ=13>
Disable Notifications<http://192.168.222.45/nagios/images/disabled.gif> Disable notifications <http://192.168.222.45/nagios/cgi-bin/cmd.cgi?cmd_typ=11>
Stop Executing Service Checks<http://192.168.222.45/nagios/images/disabled.gif> Stop executing service checks <http://192.168.222.45/nagios/cgi-bin/cmd.cgi?cmd_typ=36>
Stop Accepting Passive Service Checks<http://192.168.222.45/nagios/images/disabled.gif> Stop accepting passive service checks <http://192.168.222.45/nagios/cgi-bin/cmd.cgi?cmd_typ=38>
Disable Event Handlers<http://192.168.222.45/nagios/images/disabled.gif> Disable event handlers <http://192.168.222.45/nagios/cgi-bin/cmd.cgi?cmd_typ=42>
Start Obsessing Over Services<http://192.168.222.45/nagios/images/enabled.gif> Start obsessing over services <http://192.168.222.45/nagios/cgi-bin/cmd.cgi?cmd_typ=49>
Enable Flap Detection<http://192.168.222.45/nagios/images/enabled.gif> Enable flap detection <http://192.168.222.45/nagios/cgi-bin/cmd.cgi?cmd_typ=61>
Enable Performance Data<http://192.168.222.45/nagios/images/enabled.gif> Enable performance data <http://192.168.222.45/nagios/cgi-bin/cmd.cgi?cmd_typ=82>
Process Status Information
Process Status: OK
Check Command Output: Nagios OK: located 1 processes, program status updated 4 seconds ago
I don't from where this page comes from but it doesn't display content of my script.
What mistake i do ?
Thanks for any help
Fabrice
More information about the Developers
mailing list