Przeglądaj źródła

mp: Test if SNMP command line tools/paths are executable

fixes #6

Signed-off-by: Sven Velt <sven@velt.de>
Sven Velt 13 lat temu
rodzic
commit
1ad2c11b17
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      monitoringplugin.py

+ 6 - 0
monitoringplugin.py

@@ -487,6 +487,12 @@ class SNMPMonitoringPlugin(MonitoringPlugin):
 			self.verbose(3, 'Using commandline: ' + self.__CMDLINE_get)
 			self.verbose(3, 'Using commandline: ' + self.__CMDLINE_walk)
 
+			# Test if snmp(get|walk) are executable
+			for fpath in [self.__CMDLINE_get, self.__CMDLINE_walk,]:
+				fpath = fpath.split(' ',1)[0]
+				if not( os.path.exists(fpath) and os.path.isfile(fpath) and os.access(fpath, os.X_OK) ):
+					self.back2nagios(3, 'Could not execute "%s"' % fpath)
+
 		self.__prepared_snmp = True