naf: Added "ops"
Signed-off-by: Sven Velt <sven@velt.de>
This commit is contained in:
parent
01251ba4e3
commit
b87107d163
23
check_naf.py
23
check_naf.py
|
@ -62,6 +62,10 @@ class CheckNAF(SNMPMonitoringPlugin):
|
||||||
|
|
||||||
'NVRAM_Status': '.1.3.6.1.4.1.789.1.2.5.1.0',
|
'NVRAM_Status': '.1.3.6.1.4.1.789.1.2.5.1.0',
|
||||||
|
|
||||||
|
'OPs_NFS': ['.1.3.6.1.4.1.789.1.2.2.27.0', '.1.3.6.1.4.1.789.1.2.2.6.0', '.1.3.6.1.4.1.789.1.2.2.5.0',],
|
||||||
|
'OPs_CIFS': ['.1.3.6.1.4.1.789.1.2.2.28.0','.1.3.6.1.4.1.789.1.2.2.8.0', '.1.3.6.1.4.1.789.1.2.2.7.0',],
|
||||||
|
'OPs_HTTP': ['.1.3.6.1.4.1.789.1.2.2.29.0','.1.3.6.1.4.1.789.1.2.2.10.0', '.1.3.6.1.4.1.789.1.2.2.9.0',],
|
||||||
|
|
||||||
'Model': '.1.3.6.1.4.1.789.1.1.5.0',
|
'Model': '.1.3.6.1.4.1.789.1.1.5.0',
|
||||||
'ONTAP_Version': '.1.3.6.1.4.1.789.1.1.2.0',
|
'ONTAP_Version': '.1.3.6.1.4.1.789.1.1.2.0',
|
||||||
|
|
||||||
|
@ -222,7 +226,7 @@ class CheckNAF(SNMPMonitoringPlugin):
|
||||||
ec_size_human = self.value_to_human_binary(ec_size, unit='B')
|
ec_size_human = self.value_to_human_binary(ec_size, unit='B')
|
||||||
|
|
||||||
output = 'Cache size %s, cache usage %5.2f%%, total hits %5.2f%% ' % (ec_size_human, ec_usage, ec_hitpct)
|
output = 'Cache size %s, cache usage %5.2f%%, total hits %5.2f%% ' % (ec_size_human, ec_usage, ec_hitpct)
|
||||||
returncode = 0
|
returncode = self.RETURNCODE['OK']
|
||||||
perfdata = []
|
perfdata = []
|
||||||
perfdata.append({'label':'nacache_usage', 'value':float('%5.2f' % ec_usage), 'unit':'%'})
|
perfdata.append({'label':'nacache_usage', 'value':float('%5.2f' % ec_usage), 'unit':'%'})
|
||||||
perfdata.append({'label':'nacache_hits', 'value':ec_hits, 'unit':'c'})
|
perfdata.append({'label':'nacache_hits', 'value':ec_hits, 'unit':'c'})
|
||||||
|
@ -268,6 +272,21 @@ class CheckNAF(SNMPMonitoringPlugin):
|
||||||
return self.remember_check('nvram', returncode, output)
|
return self.remember_check('nvram', returncode, output)
|
||||||
|
|
||||||
|
|
||||||
|
def check_ops(self):
|
||||||
|
ops_nfs = self.SNMPGET(self.OID['OPs_NFS'])
|
||||||
|
ops_cifs = self.SNMPGET(self.OID['OPs_CIFS'])
|
||||||
|
ops_http = self.SNMPGET(self.OID['OPs_HTTP'])
|
||||||
|
|
||||||
|
output = 'Total ops statistics'
|
||||||
|
returncode = self.RETURNCODE['OK']
|
||||||
|
perfdata = []
|
||||||
|
perfdata.append({'label':'naops_nfs', 'value':ops_nfs, 'unit':'c'})
|
||||||
|
perfdata.append({'label':'naops_cifs', 'value':ops_cifs, 'unit':'c'})
|
||||||
|
perfdata.append({'label':'naops_http', 'value':ops_http, 'unit':'c'})
|
||||||
|
|
||||||
|
return self.remember_check('ops', returncode, output, perfdata=perfdata)
|
||||||
|
|
||||||
|
|
||||||
def check_version(self):
|
def check_version(self):
|
||||||
model = self.SNMPGET(self.OID['Model'])
|
model = self.SNMPGET(self.OID['Model'])
|
||||||
ontapversion = self.SNMPGET(self.OID['ONTAP_Version'])
|
ontapversion = self.SNMPGET(self.OID['ONTAP_Version'])
|
||||||
|
@ -456,6 +475,8 @@ def main():
|
||||||
result = plugin.check_extcache_info()
|
result = plugin.check_extcache_info()
|
||||||
elif check == 'nvram':
|
elif check == 'nvram':
|
||||||
result = plugin.check_nvram()
|
result = plugin.check_nvram()
|
||||||
|
elif check == 'ops':
|
||||||
|
result = plugin.check_ops()
|
||||||
elif check == 'version':
|
elif check == 'version':
|
||||||
result = plugin.check_version()
|
result = plugin.check_version()
|
||||||
elif check == 'vol_data':
|
elif check == 'vol_data':
|
||||||
|
|
|
@ -467,22 +467,25 @@ class SNMPMonitoringPlugin(MonitoringPlugin):
|
||||||
|
|
||||||
|
|
||||||
def SNMPGET(self, baseoid, idx=None, exitonerror=True):
|
def SNMPGET(self, baseoid, idx=None, exitonerror=True):
|
||||||
if type(baseoid) in (list, tuple) and idx != None:
|
if type(baseoid) in (list, tuple):
|
||||||
idx = str(idx)
|
if idx not in ['', None]:
|
||||||
|
idx = '.' + str(idx)
|
||||||
|
else:
|
||||||
|
idx = ''
|
||||||
|
|
||||||
if self.options.snmpversion in [1, '1']:
|
if self.options.snmpversion in [1, '1']:
|
||||||
value_low = long(self.SNMPGET_wrapper(baseoid[1] + '.' + idx, exitonerror=exitonerror))
|
value_low = long(self.SNMPGET_wrapper(baseoid[1] + idx, exitonerror=exitonerror))
|
||||||
if value_low < 0L:
|
if value_low < 0L:
|
||||||
value_low += 2 ** 32
|
value_low += 2 ** 32
|
||||||
|
|
||||||
value_hi = long(self.SNMPGET_wrapper(baseoid[2] + '.' + idx, exitonerror=exitonerror))
|
value_hi = long(self.SNMPGET_wrapper(baseoid[2] + idx, exitonerror=exitonerror))
|
||||||
if value_hi < 0L:
|
if value_hi < 0L:
|
||||||
value_hi += 2 ** 32
|
value_hi += 2 ** 32
|
||||||
|
|
||||||
return value_hi * 2L ** 32L + value_low
|
return value_hi * 2L ** 32L + value_low
|
||||||
|
|
||||||
elif self.options.snmpversion in [2, 3, '2', '2c', '3']:
|
elif self.options.snmpversion in [2, 3, '2', '2c', '3']:
|
||||||
return long(self.SNMPGET_wrapper(baseoid[0] + '.' + idx, exitonerror=exitonerror))
|
return long(self.SNMPGET_wrapper(baseoid[0] + idx, exitonerror=exitonerror))
|
||||||
|
|
||||||
elif type(baseoid) in (str, ) and idx != None:
|
elif type(baseoid) in (str, ) and idx != None:
|
||||||
return self.SNMPGET_wrapper(baseoid + str(idx), exitonerror=exitonerror)
|
return self.SNMPGET_wrapper(baseoid + str(idx), exitonerror=exitonerror)
|
||||||
|
|
Loading…
Reference in a new issue