[Nagiosplug-devel] check_hpjd gets snmpget arguments wrong w/fix

John Sellens jsellens at generalconcepts.com
Tue Apr 8 10:36:05 CEST 2003


check_hpjd invokes snmpget with (basically)
    snmpget hostname -c community
which doesn't always work, and isn't correct - the -c option (if provided)
should be before the hostname.  (Some versions accept a community following
the hostname but without -c.)

Patch for obvious fix follows.  Thanks!

John
jsellens at generalconcepts.com


*** plugins/check_hpjd.c.old	Tue Apr  8 13:19:01 2003
--- plugins/check_hpjd.c	Tue Apr  8 13:28:56 2003
***************
*** 139,146 ****
  		 HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY);
  
  	/* get the command to run */
! 	sprintf (command_line, "%s -m : -v 1 %s -c %s %s", PATH_TO_SNMPGET, address,
! 					 community, query_string);
  
  	/* run the command */
  	child_process = spopen (command_line);
--- 139,146 ----
  		 HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY);
  
  	/* get the command to run */
! 	sprintf (command_line, "%s -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET,
! 					 community, address, query_string);
  
  	/* run the command */
  	child_process = spopen (command_line);




More information about the Devel mailing list