# Author: # Object: # ################################################################################ import logging as log import re import datetime from monitoring.nagios.plugin import NagiosPluginSNMP logger = log.getLogger('plugin') # The main procedure desc_plug = "This plugin returns the isdnCallHistory table." plugin = NagiosPluginSNMP(version=0.1, description=desc_plug) oid = { 'isdnCallHistoryType': '1.3.6.1.4.1.272.4.2.8.1.2', 'isdnCallHistoryTime': '1.3.6.1.4.1.272.4.2.8.1.3', 'isdnCallHistoryDuration': '1.3.6.1.4.1.272.4.2.8.1.4', 'isdnCallHistoryRemoteNumber': '1.3.6.1.4.1.272.4.2.8.1.8', } call_type = { 1: 'Incoming', 2: 'Outgoing', } query = plugin.snmp.getnext(oid) # Store temp data
# # import logging as log import re from shared import __version__ from monitoring.nagios.plugin import NagiosPluginSNMP logger = log.getLogger('plugin') # The main procedure progdesc = 'Check all PSU of Cisco and alert if one is not on.' plugin = NagiosPluginSNMP(version=__version__, description=progdesc) oids = { 'psu_status': '1.3.6.1.4.1.9.9.117.1.1.2.1.2', # From CISCO-ENTITY-FRU-CONTROL-MIB 'psu_descs': '1.3.6.1.2.1.47.1.1.1.1.2', # From ENTITY-MIB } desc = { 1: 'offEnvOther', 2: 'on', 3: 'offAdmin', 4: 'offDenied', 5: 'offEnvPower', 6: 'offEnvTemp', 7: 'offEnvFan', 8: 'failed',
# a copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # TODO: Convert to unittest. import sys sys.path.insert(0, '..') from monitoring.nagios.plugin import NagiosPluginSNMP plugin = NagiosPluginSNMP(version='1.0', description='Test SNMPQuery class') results = plugin.snmp.get({ 'name': '1.3.6.1.2.1.1.5.0', }) print results