[Nagiosplug-checkins] nagiosplug/plugins check_dhcp.c,1.2,1.3

Stanley Hopcroft stanleyhopcroft at users.sourceforge.net
Mon Dec 20 01:05:05 CET 2004


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25070/nagiosplug/plugins

Modified Files:
	check_dhcp.c 
Log Message:
Compilation fixes for check_dhcp.c HP-UX 11. Still fails on HP-UX 10. Unknown if check_dhcp works on UX.

Index: check_dhcp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dhcp.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- check_dhcp.c	10 Dec 2004 00:52:53 -0000	1.2
+++ check_dhcp.c	20 Dec 2004 09:04:34 -0000	1.3
@@ -55,7 +55,7 @@
 #include <sys/sysctl.h>
 #include <net/if_dl.h>
 
-#elif defined(__sun__) || defined(__solaris__)
+#elif defined(__sun__) || defined(__solaris__) || defined(__hpux__)
 
 #define INSAP 22 
 #define OUTSAP 24 
@@ -367,13 +367,30 @@
 		exit(STATE_UNKNOWN);
 	}
 
+#elif defined(__hpux__)
+
+	/* Martin Kompf again
+         *
+         * Nagios plugins thank you sincerely
+         */
+
+	long stat;
+	char dev[20] = "/dev/dlpi" ;
+	int unit = 0;
+
+	stat = mac_addr_dlpi(dev, unit, client_hardware_address);
+	if (stat != 0) {
+		printf("Error: can't read MAC address from DLPI streams interface for device %s unit %d.\n", dev, unit);
+		exit(STATE_UNKNOWN);
+	}
+
 #else
-	printf("Error: can't get MAC address for this architcture.\n");
+	printf("Error: can't get MAC address for this architecture.\n");
 	exit(STATE_UNKNOWN);
 #endif
 
 	if (verbose) { 
-		printf( "Hadrware address: ");
+		printf( "Hardware address: ");
 		for (i=0; i<6; ++i)
 			printf("%2.2x", client_hardware_address[i]);
 		printf( "\n");
@@ -1137,7 +1154,7 @@
 	return OK;
         }
 
-#if defined(__sun__) || defined(__solaris__)
+#if defined(__sun__) || defined(__solaris__) || defined(__hpux__)
 
 
 /*





More information about the Commits mailing list