Page 1 of 1

[Nagios-devel] [PATCH] - Schedule (host + all services )downtime

Posted: Thu Sep 10, 2009 11:42 am
by Guest
This is a multi-part message in MIME format.
--------------030907050302020101030504
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi List,

the following patch brings a new link to the command box for the
extinfo.cgi (Host Detail View).
I was often asked to schedule a downtime for a particular host _and_
alle of his services but up to the latest CVS Head it isn't possible
to do it through the CGIs.

Please review this patch / feature request.

- -
Hendrik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFKqO4qlI0PwfxLQjkRAry/AJ0beJdOW3gaML/koGWAdFqAO/irAwCfXfUb
z1RhdcX/79F2un1kkvoqhwo=
=I3lG
-----END PGP SIGNATURE-----


--------------030907050302020101030504
Content-Type: text/plain;
name="nagios-extinfo-cgi-HOST_SVC_DOWNTIME.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="nagios-extinfo-cgi-HOST_SVC_DOWNTIME.patch"

diff -Naur a/cgi/cmd.c b/cgi/cmd.c
--- a/cgi/cmd.c 2009-09-10 13:33:28.000000000 +0200
+++ b/cgi/cmd.c 2009-09-10 13:58:32.000000000 +0200
@@ -792,10 +792,6 @@
printf("schedule downtime for a particular %s",(cmd==CMD_SCHEDULE_HOST_DOWNTIME)?"host":"service");
break;

- case CMD_SCHEDULE_HOST_SVC_DOWNTIME:
- printf("schedule downtime for all Services for a particular host");
- break;
-
case CMD_PROCESS_HOST_CHECK_RESULT:
case CMD_PROCESS_SERVICE_CHECK_RESULT:
printf("submit a passive check result for a particular %s",(cmd==CMD_PROCESS_HOST_CHECK_RESULT)?"host":"service");
@@ -1157,7 +1153,6 @@
break;

case CMD_SCHEDULE_HOST_DOWNTIME:
- case CMD_SCHEDULE_HOST_SVC_DOWNTIME:
case CMD_SCHEDULE_SVC_DOWNTIME:

printf("Host Name:");
@@ -1646,7 +1641,6 @@
case CMD_DISABLE_HOST_CHECK:
case CMD_REMOVE_HOST_ACKNOWLEDGEMENT:
case CMD_SCHEDULE_HOST_DOWNTIME:
- case CMD_SCHEDULE_HOST_SVC_DOWNTIME:
case CMD_DELAY_HOST_NOTIFICATION:
case CMD_ENABLE_HOST_FLAP_DETECTION:
case CMD_DISABLE_HOST_FLAP_DETECTION:
@@ -1658,7 +1652,7 @@
case CMD_STOP_OBSESSING_OVER_HOST:

/* make sure we have author name and comment data... */
- if(cmd==CMD_SCHEDULE_HOST_DOWNTIME||cmd==CMD_SCHEDULE_HOST_SVC_DOWNTIME){
+ if(cmd==CMD_SCHEDULE_HOST_DOWNTIME){
if(!strcmp(comment_data,"")){
if(!error_string)
error_string=strdup("Comment was not entered");
@@ -1675,7 +1669,7 @@
authorized=TRUE;

/* clean up the comment data if scheduling downtime */
- if(cmd==CMD_SCHEDULE_HOST_DOWNTIME||cmd==CMD_SCHEDULE_HOST_SVC_DOWNTIME){
+ if(cmd==CMD_SCHEDULE_HOST_DOWNTIME){
clean_comment_data(comment_author);
clean_comment_data(comment_data);
}
@@ -1687,7 +1681,7 @@
}

/* make sure we have start/end times for downtime (if necessary) */
- if((cmd==CMD_SCHEDULE_HOST_DOWNTIME||cmd==CMD_SCHEDULE_HOST_SVC_DOWNTIME) && (start_time==(time_t)0 || end_time==(time_t)0 || start_time>end_time)){
+ if(cmd==CMD_SCHEDULE_HOST_DOWNTIME && (start_time==(time_t)0 || end_time==(time_t)0 || start_time>end_time)){
if(!error_string)
error_string=strdup("Start or end time not valid");
}
@@ -2110,10 +2104,6 @@
result = cmd_submitf(cmd,"%s;%lu;%lu;%d;%lu;%lu;%s;%s",host_name,start_time,end_time,fixed,triggered_by,duration,comment_author,comment_data);
break;

- case CMD_SCHEDULE_HOST_SVC_DOWNTIME:
- result = cmd_submitf(cmd,"%s;%lu;%lu;%d;%lu;%lu;%s;%s",host_name,start_time,end_time,fixed,triggered_by,duration,comment_author,comment_data);
- break;
-
case CMD_SCHEDULE_SVC_DOWNTIME:
result = cmd_submitf(cmd,"%s;%s;%lu;%lu;%d;%lu;%lu;%s;%s",host_name,service_desc,start_time,end_time,fixed,triggered_by,duration,comment_author,comment_data);
break;
@@ -2532,15 +2522,6 @@
printf("start and end times you specified) and lasts as long as the duration of time you enter. The duration fields do not apply for fixed downtime.\n");
break;

- case CMD_SCHEDULE_HOST_SVC_DOWNTIME:
- printf("This command is used to schedule downtime for a particular host and all of his services. During the specified downtime, Nagios will not send notifications out about the host.\n");
- printf("When the scheduled

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]