[Pkg-nagios-devel] Bug#401738: Acknowledgement (nagios2: statuswml.cgi cannot schedule check commands)

debian-bugreport at pfy.nu debian-bugreport at pfy.nu
Wed Dec 6 12:10:50 CET 2006


I've found the cause of the problem: When using a normal browser
cmd.cgi is called from extinfo.cgi, where extinfo.cgi generates the
start_time <input> parameter. When calling statuswml.cgi it also
calls cmd.cgi but does not generate a start_time parameter. I made
some changes to the code to make it generate the parameter. 

--- nagios2-2.5/cgi/statuswml.c	2006-03-22 18:45:26.000000000 +0100
+++ nagios2-2.5_new/cgi/statuswml.c	2006-12-05 17:54:32.000000000 +0100
@@ -1047,6 +1047,7 @@
 	service *temp_service;
 	servicestatus *temp_servicestatus;
 	char last_check[MAX_DATETIME_LENGTH];
+	char buffer[MAX_INPUT_BUFFER];
 	int days;
 	int hours;
 	int minutes;
@@ -1155,8 +1156,10 @@
 	if(temp_servicestatus->checks_enabled==FALSE)
 		printf("<b><anchor title='Enable Checks'>Enable Checks<go href='%s' method='post'><postfield name='host' value='%s'/><postfield name='service' value='%s'/><postfield name='cmd_typ' value='%d'/><postfield name='cmd_mod' value='%d'/><postfield name='content' value='wml'/></go></anchor></b><br/>\n",COMMAND_CGI,host_name,service_desc,CMD_ENABLE_SVC_CHECK,CMDMODE_COMMIT);
 	else{
+	  time(&t);
+	  get_time_string(&t,buffer,sizeof(buffer)-1,SHORT_DATE_TIME);
 		printf("<b><anchor title='Disable Checks'>Disable Checks<go href='%s' method='post'><postfield name='host' value='%s'/><postfield name='service' value='%s'/><postfield name='cmd_typ' value='%d'/><postfield name='cmd_mod' value='%d'/><postfield name='content' value='wml'/></go></anchor></b><br/>\n",COMMAND_CGI,host_name,service_desc,CMD_DISABLE_SVC_CHECK,CMDMODE_COMMIT);
-		printf("<b><anchor title='Schedule Immediate Check'>Schedule Immediate Check<go href='%s' method='post'><postfield name='host' value='%s'/><postfield name='service' value='%s'/><postfield name='cmd_typ' value='%d'/><postfield name='cmd_mod' value='%d'/><postfield name='content' value='wml'/></go></anchor></b><br/>\n",COMMAND_CGI,host_name,service_desc,CMD_SCHEDULE_SVC_CHECK,CMDMODE_COMMIT);
+		printf("<b><anchor title='Schedule Immediate Check'>Schedule Immediate Check<go href='%s' method='post'><postfield name='host' value='%s'/><postfield name='service' value='%s'/><postfield name='cmd_typ' value='%d'/><postfield name='cmd_mod' value='%d'/><postfield name='content' value='wml'/><postfield name='start_time' value='%s'/></go></anchor></b><br/>\n",COMMAND_CGI,host_name,service_desc,CMD_SCHEDULE_SVC_CHECK,CMDMODE_COMMIT, buffer);
 	        }
 
 	if(temp_servicestatus->notifications_enabled==FALSE)

-- 
Mathias Jansson
System Administrator, Midasplayer AB
S:t Göransgatan 66
SE-112 33 Stockholm
Mobile. +46 (0)70 811 75 40
Fax. +46 (0)8 545 70 439






More information about the Pkg-nagios-devel mailing list