[Nagios-users] "distributable" downtime delete commands?

Paul Dubuc work at paul.dubuc.org
Tue Feb 5 16:34:05 CET 2013


Paul Dubuc wrote:
> Among the enhancements listed for Nagios 3.3.1:
>
> 	3.3.1. - 07/25/2011
> 	ENHANCEMENTS
>
> 	    * Downtime delete commands made "distributable" by deleting
> 	 by host group name, host name or start time/comment (Opsview team)
>
> Where are these commands documented?  I don't see them in the online
> documentation:
>
> http://old.nagios.org/developerinfo/externalcommands/commandlist.php?category_id=6&version_id=0&btnSubmit=Update
>
> only lists delete commands that require a downtime ID.

OK, so these are apparently not documented anywhere except the source code. 
I'm reading it to figure out how this works and I'm puzzled by the following 
code in cmd_delete_downtime_by_hostgroup_name() in base/commands.c (version 
3.4.4 source):


>  /* get the optional host name */
>         temp_ptr = my_strtok(NULL, ";");
>         if(temp_ptr != NULL) {
>                 if(*temp_ptr != '\0')
>                         host_name = temp_ptr;
>
>                 /* get the optional service name */
>                 temp_ptr = my_strtok(NULL, ";");
>                 if(temp_ptr != NULL) {
>                         if(*temp_ptr != '\0')
>                                 service_description = temp_ptr;
>
>                         /* get the optional start time */
>                         temp_ptr = my_strtok(NULL, ";");
>                         if(temp_ptr != NULL) {
>                                 downtime_start_time = strtoul(temp_ptr, &end_ptr, 10);
>
>                                 /* get the optional comment */
>                                 temp_ptr = my_strtok(NULL, ";");
>                                 if(temp_ptr != NULL) {
>                                         if(*temp_ptr != '\0')
>                                                 downtime_comment = temp_ptr;
>
>                                         }
>                                 }
>                         }
>
>                 /* get the optional service name */
>                 temp_ptr = my_strtok(NULL, ";");
>                 if(temp_ptr != NULL) {
>                         if(*temp_ptr != '\0')
>                                 service_description = temp_ptr;
>
>                         /* get the optional start time */
>                         temp_ptr = my_strtok(NULL, ";");
>                         if(temp_ptr != NULL) {
>                                 downtime_start_time = strtoul(temp_ptr, &end_ptr, 10);
>
>                                 /* get the optional comment */
>                                 temp_ptr = my_strtok(NULL, ";");
>                                 if(temp_ptr != NULL) {
>                                         if(*temp_ptr != '\0')
>                                                 downtime_comment = temp_ptr;
>                                         }
>                                 }
>                         }
>                 }

Am I missing something, or is there an unnecessary duplication of the "get the 
optional service name" code block here?

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb




More information about the Developers mailing list