def setUp(self): self.argv_store = sys.argv from pynag.Plugins import PluginHelper self.my_plugin = PluginHelper() self.my_plugin.parser.add_option('-F', dest='fakedata', help='fake data to test thresholds')
def check_metric(self): """Check if the metric value is within the threshold range, and exits with status code, message and perfdata. """ # Get values metric_values = self._get_metric_values() unit = self._AZURE_METRICS_UNIT_SYMBOLS.get( self._metric_properties['unit']) if unit is None: unit = '' # Test if value to display if metric_values is None: message = 'No value available for metric {}'.format(self['metric']) if self['dimension'] is not None: message += ' and dimension {}'.format(self['dimension']) self.nagios_exit(Plugins.UNKNOWN, message) # PluginHelper of pynag import # https://pynag.readthedocs.io/en/latest/pynag.Plugins.html?highlight=check_threshold#pynag.Plugins.PluginHelper p = PluginHelper() # For each value, declare metric with according thresholds for metric_idx in metric_values: p.add_metric(label=metric_idx, value=metric_values[metric_idx], uom=unit, warn=self['warning'], crit=self['critical']) # Test all metrics according to there thresholds p.check_all_metrics() # Add global summary for output p.add_summary(self._metric_properties['name']['localizedValue']) # Exit and display plugin output p.exit()
#!/usr/bin/env python # # Get a list of northatlantic airplanes via flightradar # import requests from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper, ok, warning, critical, unknown import simplejson as json p = PluginHelper() p.parser.add_option( "--url", dest="url", default="http://db8.flightradar24.com/zones/northatlantic_all.js?callback=pd_callback&_=1373991753137", ) p.parse_arguments() html = requests.get(p.options.url).content html = html.replace("pd_callback(", "") html = html.replace(");", "") json_data = json.loads(html) flights = json_data.values() for i in flights: # print i # print "..." pass p.add_metric("total_airplanes", len(flights), warn="0..1")
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_ilo4.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module from pynag.Plugins import PluginHelper, ok, critical, unknown import netsnmp import sys import os sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data, walk_data, attempt_walk_data, state_summary, add_output # Create an instance of PluginHelper() helper = PluginHelper() # Define the command line options add_common_options(helper) helper.parser.add_option('--drives', help='Amount of physical drives', dest='amount_drvs') helper.parser.add_option('--ps', help='Amount of connected power supplies', dest='amount_pwr_sply') helper.parser.add_option('--fan', help='Amount of fans', dest='amount_fans') helper.parser.add_option( '--scan', help= 'Scan the server if you do not know what is build in (does not return a health status)', default=False,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_idrac.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module from pynag.Plugins import PluginHelper, ok, critical import netsnmp import sys import os sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data, walk_data, state_summary, add_output # Create an instance of PluginHelper() helper = PluginHelper() # Define the command line options add_common_options(helper) helper.parse_arguments() # Get the options host, version, community = get_common_options(helper) # States definitions normal_state = { 1: 'other', 2: 'unknown', 3: 'ok', 4: 'nonCritical', 5: 'critical',
#!/usr/bin/env python import requests import string import random import sys reload(sys) sys.setdefaultencoding('utf-8') from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper, ok, warning, critical, unknown p = PluginHelper() chars = string.letters + string.digits randomstring = ''.join([random.choice(chars) for i in xrange(4)]) # avoid cache default_url = 'http://landspitali.is' p.parser.add_option('--url', dest='url', default=default_url) p.parse_arguments() p.check_all_metrics() p.show_legacy = True html = requests.get(p.options.url).content soup = BeautifulSoup(html) activitylist = soup.find('div', {'class': 'activityNumbers activityNumbersNew'}) activities = activitylist.findAll('div', recursive=False) p.add_metric('metrics_found', value=len(activities), warn='0..1') p.add_summary('%s metrics found on landspitali website' % (len(activities)))
def main(): helper = PluginHelper() helper.parser.add_option('-w', help='warning free (X% or XM)', dest='warning') helper.parser.add_option('-c', help='critical free (X% or XM)', dest='critical') helper.parse_arguments() warn = helper.options.warning crit = helper.options.critical memory = getMemory() if helper.options.warning is not None: warn = helper.options.warning if re.match('.*%$', warn): warn = str(memory['total'] * int(re.search('\d*', warn).group(0)) / 100) else: warn = '0' if helper.options.critical is not None: crit = helper.options.critical if re.match('.*%$', crit): crit = str(memory['total'] * int(re.search('\d*', crit).group(0)) / 100) else: crit = '0' helper.status(ok) status = "OK" if memory['totalfree'] <= int(warn): helper.status(warning) status = "WARNING" if memory['totalfree'] <= int(crit): helper.status(critical) status = "CRITICAL" helper.add_summary(status + ': Memory free: %(totalfree)s %% (%(free)s %% including buffers/cached)' % {'totalfree': (round((float(memory['totalfree']) / float(memory['total']) * 100), 1 )), 'free': (round((float(memory['free']) / float(memory['total']) * 100), 1 ))}) helper.add_metric(label='total',value=memory['total']) helper.add_metric(label='free',value=memory['free']) helper.add_metric(label='totalfree',value=memory['totalfree'], warn=warn+'..0', crit=crit+'..0') helper.add_metric(label='used',value=memory['used']) helper.add_metric(label='buffers',value=memory['buffers']) helper.add_metric(label='cached',value=memory['cached']) helper.add_metric(label='swapcached',value=memory['swapcached']) helper.check_all_metrics() helper.exit()
from snmpSessionBaseClass import * import pytest import subprocess from pynag.Plugins import PluginHelper # States definitions normal_state = { 1 : 'other', 2 : 'ok', 3 : 'degraded', 4 : 'failed' } # create an instance of PluginHelper() helper = PluginHelper() # create netsnmp Session for test_get, test_attempt_get, test_walk and test_attempt_walk session = netsnmp.Session(Version=2, DestHost='localhost', Community='public') failSession = netsnmp.Session(Version=2, DestHost='1.2.3.4', Community='public') def get_system_uptime(): """ just a helper to get the system uptime in seconds """ with open('/proc/uptime', 'r') as f: uptime_seconds = str(f.readline().split()[0]) uptime_seconds = uptime_seconds.replace('.', '') return str(uptime_seconds) def test_get(capsys):
def append_output(helper, state, short_output_line, long_output_line): helper.add_status(state) helper.add_summary(short_output_line) helper.add_long_output(long_output_line) def get_state(value, warning_threshold, critical_threshold): if value >= critical_threshold: return critical elif value >= warning_threshold: return warning else: return ok if __name__ == '__main__': helper = PluginHelper() add_common_options(helper) add_snmpv3_options(helper) helper.parser.add_option('-p', '--port', dest='port', help='Moxa RS232 port number.', type='str') helper.parser.add_option('-t', '--type', dest='type', help= """Available check types: CTS, DSR, DTR, ErrorCount. Example: -t CTS_ErrorCount. CTS (Clear To Send): DCE (Data Communication Equipment) is ready to accept data from the DTE (Data Terminal Equipment). DSR (Data Set Ready): DCE (Data Communication Equipment) is ready to receive commands or data. DTR (Data Terminal Ready): DTE (Data Terminal Equipment) is ready to receive, initiate, or continue a call. ErrorCount = Show error counts of Frame, Break, Overrun and Parity.""" , type='str') helper.parser.add_option('-c', '--critical', dest='critical', help='Return CRITICAL if any ErrorCount >= this parameter.', default=sys.maxint, type='int') helper.parser.add_option('-w', '--warning', dest='warning', help='Return WARNING if any ErrorCount >= this parameter.', default=1, type='int') helper.parse_arguments()
#!/usr/bin/env python ####################### check_apachestatus.py ####################### # Licence : GPL - http://www.fsf.org/licenses/gpl.txt ############################################################# # Inspired by De Bodt Lieven's perl implementation # 20140428 <morgajel at gmail dot com> v1.6 # rewriting in python from pynag.Plugins import PluginHelper,ok,warning,critical,unknown import urllib2 import re import sys import time # Create an instance of PluginHelper() my_plugin = PluginHelper() # Add all of our wonderful flags my_plugin.parser.add_option('-H', '--hostname', type="string", default="127.0.0.1", dest="hostname" ) my_plugin.parser.add_option('-p', '--port', type="int", default="80", dest="port" ) my_plugin.parser.add_option('-s', '--ssl', help="enable ssl", action="store_true", dest="ssl" ) my_plugin.parser.add_option('-w', '--warning', type="string", default="5", dest="warning" ) my_plugin.parser.add_option('-c', '--critical', type="string", default="10", dest="critical" ) my_plugin.parse_arguments() # Set the proper protocol if my_plugin.options.ssl: my_plugin.options.protocol='https' else: my_plugin.options.protocol='http'
def walk_data(host, version, community, oid): var = netsnmp.Varbind(oid) try: data = netsnmp.snmpwalk(var, Version=version, DestHost=host, Community=community) except: helper.exit(summary="\n SNMP connection to device failed " + oid, exit_code=unknown, perfdata='') if not data: helper.exit(summary="\n SNMP connection to device failed " + oid, exit_code=unknown, perfdata='') return data # function to calculate the real value def real_value(value, digit): return str(float(value) / math.pow(10, float(digit))) # Create an instance of PluginHelper() helper = PluginHelper() # define the command line options helper.parser.add_option('-H', help="Hostname or ip address", dest="hostname") helper.parser.add_option('-C', '--community', dest='community', help='SNMP community of the SNMP service on target host.', default='public') helper.parser.add_option('-V', '--snmpversion', dest='version', help='SNMP version. (1 or 2)', default=2, type='int') helper.parser.add_option('-t', help="The type you want to monitor (inlet, outlet, sensor)", default="inlet", dest="typ") helper.parser.add_option('-i', help="The id of the outlet / sensor you want to monitor (1-99)", default="1", dest="id") helper.parse_arguments() # get the options id = helper.options.id typ = helper.options.typ host = helper.options.hostname version = helper.options.version community = helper.options.community
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along check_snmp_lband.py. If not, see <http://www.gnu.org/licenses/>. import sys import os import netsnmp sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data from pynag.Plugins import PluginHelper,ok,warning,critical,unknown # Create an instance of PluginHelper() helper = PluginHelper() # Define the command line options add_common_options(helper) helper.parser.add_option('-U', '--unit', dest='unit', help='Select the unit you want to monitor, if no unit is selected both units will be monitored', default="1") helper.parse_arguments() # get the options host, version, community = get_common_options(helper) unit = helper.options.unit # OIDs from 2082-141.mib.txt unit1_oid = ".1.3.6.1.4.1.31210.52.1.9.0" unit2_oid = ".1.3.6.1.4.1.31210.52.1.13.0" status = {
#!/usr/bin/python import os.path import sys pynagbase = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)) sys.path[0] = pynagbase # Standard init from pynag.Plugins import PluginHelper,ok # Create an instance of PluginHelper() my_plugin = PluginHelper() # Feed fake data for range checking my_plugin.parser.add_option('-F', dest='fakedata', help='fake data to test thresholds') # Activate my_plugin.parse_arguments() my_plugin.add_status(ok) my_plugin.add_summary(my_plugin.options.fakedata) my_plugin.add_metric('fakedata', my_plugin.options.fakedata) my_plugin.check_all_metrics() my_plugin.exit()
#!/usr/bin/python # check_snimpy.py - Check arbitrary snmp values using snimpy. Thresholds can be specified from the commandline # Import PluginHelper and some utility constants from the Plugins module from pynag.Plugins import PluginHelper,ok,warning,critical,unknown # Import Snimpy from snimpy.manager import Manager from snimpy.manager import load # Create an instance of PluginHelper() helper = PluginHelper() # Optionally, let helper handle command-line arguments for us for example --threshold # Note: If your plugin needs any commandline arguments on its own (like --hostname) you should add them # before this step with helper.parser.add_option() helper.parser.add_option("-H", help="Hostname or IP", dest="host", default='localhost') helper.parser.add_option("--Version", help="Snmp Version", dest="version", default='2') helper.parser.add_option("-c", help="Snmp Comunity", dest="community", default='public') helper.parse_arguments() mib='/usr/share/mibs/site/NetSure-SCU-Plus' # Here starts our plugin specific logic. Lets try to read /proc/loadavg # And if it fails, we exit immediately with UNKNOWN status try: load(mib) except Exception, e: helper.exit(summary="Could not read MIB file.", long_output=str(e), exit_code=unknown, perfdata='')
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_teledyne.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module import sys import os import netsnmp sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data from pynag.Plugins import PluginHelper,ok,critical # Create an instance of PluginHelper() helper = PluginHelper() # add the common command line options add_common_options(helper) helper.parse_arguments() # get the options host, version, community = get_common_options(helper) # OIDs from MBG-LANTIME-NG-MIB.mib oids = { "Unit 1" : "iso.3.6.1.4.1.20712.2.1.3.1.2.1", "Unit 2" : "iso.3.6.1.4.1.20712.2.1.3.1.2.2", "Unit 3" : "iso.3.6.1.4.1.20712.2.1.3.1.2.3", "Fault Summary" : "iso.3.6.1.4.1.20712.2.1.3.1.2.4",
self.port = port self.timeout = timeout def cmd(self, word): """Connect and send a 4letter command to Zookeeper. """ # Zookeeper closes the socket after every command, so we must reconnect every time. tn = Telnet(self.host, self.port, self.timeout) tn.write('{}\n'.format(word)) return tn.read_all() if __name__ == '__main__': plugin = PluginHelper() plugin.parser.add_option("-H","--hostname", help="Zookeeper's host", default='127.0.0.1') plugin.parser.add_option("-p","--port", help="Zookeeper's port", default='2181') plugin.parse_arguments() try: zk = ZkClient(plugin.options.hostname, plugin.options.port) except socket.error: plugin.status(critical) plugin.add_summary("Can't connect to {}:{}".format(plugin.options.hostname, plugin.options.port)) plugin.exit() try: if zk.cmd('ruok') != 'imok': plugin.status(critical) plugin.add_summary("Command 'ruok' failed")
# check_stuff.py Takes any arguments from the command_line and treats them as performance metrics. from pynag.Plugins import PluginHelper my_plugin = PluginHelper() my_plugin.parse_arguments() # Any perfdatastring added as argument will be treated as a performance metric for i in my_plugin.arguments: my_plugin.add_metric(perfdatastring=i) my_plugin.check_all_metrics() my_plugin.exit()
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_ilo4.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module from pynag.Plugins import PluginHelper,ok,critical,unknown import netsnmp import sys import os sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, verify_seclevel, add_snmpv3_options, get_common_options, verify_host, get_data, walk_data, attempt_walk_data, state_summary, add_output # Create an instance of PluginHelper() helper = PluginHelper() # Define the command line options add_common_options(helper) helper.parser.add_option('--drives', help='Amount of physical drives', dest='amount_drvs') helper.parser.add_option('--ps', help='Amount of connected power supplies', dest='amount_pwr_sply') helper.parser.add_option('--fan', help='Amount of fans', dest='amount_fans') helper.parser.add_option('--scan', help='Scan the server if you do not know what is build in (does not return a health status)', default=False, action='store_true', dest='scan_server') helper.parser.add_option('--noStorage', help='Do not check global storage condition', default=True, action='store_false', dest='no_storage') helper.parser.add_option('--noSystem', help='Do not check global system state', default=True, action='store_false', dest='no_system') helper.parser.add_option('--noPowerSupply', help='Do not check global power supply condition', default=True, action='store_false', dest='no_power_supply') helper.parser.add_option('--noPowerState', help='Do not check power state', default=True, action='store_false', dest='no_power_state') helper.parser.add_option('--noTemp', help='Do not check Overall thermal environment condition', default=True, action='store_false', dest='no_temp') helper.parser.add_option('--noTempSens', help='Do not check temperature sensor condition', default=True, action='store_false', dest='no_temp_sens') helper.parser.add_option('--noDriveTemp', help='Do not check temperature sensor of the hard drives', default=True, action='store_false', dest='no_drive_sens')
#!/usr/bin/env python import requests import string import sys reload(sys) sys.setdefaultencoding('utf-8') from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper,ok,warning,critical,unknown p = PluginHelper() default_url = 'http://www.isanicelandicvolcanoerupting.com' p.parser.add_option('--url', dest='url', default=default_url) p.parse_arguments() p.show_legacy = True html = requests.get(p.options.url).content soup = BeautifulSoup(html) answer = soup.find('h3').text p.add_summary('Source says: "%s"' % answer) if 'yes' in answer.lower(): p.status(warning) elif 'no' in answer.lower(): p.status(ok) else: p.status(unknown)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_janitza.py. If not, see <http://www.gnu.org/licenses/>. # Imports from pynag.Plugins import PluginHelper, ok, warning, critical, unknown import commands, sys, argparse, math import netsnmp import os sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data # Create an instance of PluginHelper() helper = PluginHelper() # Define the command line options add_common_options(helper) helper.parser.add_option( '-t', '--type', dest='power_Status', help='Select a Type, for a list of all possible Types use the argument -l') helper.parser.add_option('-l', '--list', dest='listFlag', default='False', action='store_true', help='Lists all output possibilities') helper.parse_arguments()
# -*- coding: utf-8 -*- # This script connects to vedur.is and checks if there is an avalance alert import requests import string import random import sys import re import numpy as np reload(sys) sys.setdefaultencoding('utf-8') from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper, ok, warning, critical, unknown p = PluginHelper() chars = string.letters + string.digits randomstring = ''.join([random.choice(chars) for i in xrange(4)]) # avoid cache default_url = 'http://www.vedur.is/ofanflod/snjoflodaspa' p.parser.add_option('--url', dest='url', default=default_url) p.parse_arguments() p.show_legacy = True html = requests.get(p.options.url).content # Initial Status is OK, unless avalanche threats detected. p.status(ok) # We are going to parse the html and look for certain divs, according to the vedur.is page
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with "Health Monitoring Plugins". If not, see <https://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module import sys import os import netsnmp sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data from pynag.Plugins import PluginHelper, ok, critical # Create an instance of PluginHelper() helper = PluginHelper() # add the common command line options add_common_options(helper) helper.parse_arguments() # get the options host, version, community = get_common_options(helper) # OIDs from MBG-LANTIME-NG-MIB.mib oids = { "Unit 1": "iso.3.6.1.4.1.20712.2.1.3.1.2.1", "Unit 2": "iso.3.6.1.4.1.20712.2.1.3.1.2.2", "Unit 3": "iso.3.6.1.4.1.20712.2.1.3.1.2.3", "Fault Summary": "iso.3.6.1.4.1.20712.2.1.3.1.2.4", "Power Supply 1": "iso.3.6.1.4.1.20712.2.1.3.1.2.5",
#!/usr/bin/python import os.path import sys pynagbase = os.path.abspath( os.path.join(os.path.dirname(__file__), os.path.pardir)) sys.path[0] = pynagbase # Standard init from pynag.Plugins import PluginHelper, ok # Create an instance of PluginHelper() my_plugin = PluginHelper() # Feed fake data for range checking my_plugin.parser.add_option('-F', dest='fakedata', help='fake data to test thresholds') # Activate my_plugin.parse_arguments() my_plugin.add_status(ok) my_plugin.add_summary(my_plugin.options.fakedata) my_plugin.add_metric('fakedata', my_plugin.options.fakedata) my_plugin.check_all_metrics() my_plugin.exit()
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_procurve.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module import sys import os import netsnmp sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, walk_data from pynag.Plugins import PluginHelper, ok, critical, unknown, warning # Create an instance of PluginHelper() helper = PluginHelper() # Add command line parameters add_common_options(helper) helper.parse_arguments() # get the options host, version, community = get_common_options(helper) # The OIDs we need oid_description = ".1.3.6.1.4.1.11.2.14.11.1.2.6.1.7" # The sensor description (e.g. Power Supply Sensor or Fan Sensor) oid_status = ".1.3.6.1.4.1.11.2.14.11.1.2.6.1.4" # The status of the sensor # Status table senor_status_table = { "1": "unknown",
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_fortinet.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module import sys import os import math import netsnmp sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data, walk_data from pynag.Plugins import PluginHelper,ok,warning,critical,unknown # Create an instance of PluginHelper() helper = PluginHelper() # define the command line options add_common_options(helper) helper.parser.add_option('-t', '--type', dest='type', default="ressources", help = "Check type to execute. Available types are: ressources, controller, accesspoints", type='str') helper.parse_arguments() # get the options type = helper.options.type host, version, community = get_common_options(helper) # these dicts / definitions we need to get human readable values operational_states = { 0 : "unknown", 1 : "enabled",
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_large_storage.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module import sys import os import netsnmp sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data, walk_data, add_snmpv3_options from pynag.Plugins import PluginHelper, ok, unknown # Create an instance of PluginHelper() helper = PluginHelper() # Add command line parameters add_common_options(helper) add_snmpv3_options(helper) helper.parser.add_option('-p', '--partition', dest='partition', help='The disk / partition you want to monitor', type='str') helper.parser.add_option('-u', '--unit', dest="targetunit", help="The unit you want to have (MB, GB, TB)", default="GB") helper.parser.add_option('-s', '--scan', dest='scan_flag', default=False, action="store_true", help='Show all available storages') helper.parse_arguments() # get the options
import requests import string import random import sys import re import numpy as np reload(sys) sys.setdefaultencoding('utf-8') from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper,ok,warning,critical,unknown p = PluginHelper() chars = string.letters + string.digits randomstring= ''.join([random.choice(chars) for i in xrange(4)]) # avoid cache default_url = 'http://www.vedur.is/ofanflod/snjoflodaspa' p.parser.add_option('--url', dest='url', default=default_url) p.parse_arguments() p.show_legacy = True html = requests.get(p.options.url).content # Initial Status is OK, unless avalanche threats detected. p.status(ok) # We are going to parse the html and look for certain divs, according to the vedur.is page # it should have the following threat codes:
# You should have received a copy of the GNU General Public License # along with "Health Monitoring Plugins". If not, see <https://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module import sys import os import urllib2 import json import base64 from datetime import datetime sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from pynag.Plugins import PluginHelper, ok, critical, unknown, warning # Create an instance of PluginHelper() helper = PluginHelper() helper.parser.add_option('-p', help="the port the Jenkins webserver (default: 80)", dest="port", default="80") helper.parser.add_option('-H', help="the IP address or hostname of the Jenkins", dest="host", default="127.0.0.1") helper.parser.add_option('-U', help="the user for the basic authentication", dest="user", default="user") helper.parser.add_option( '-P', help="the password for the basic authentication or the API token",
import requests import string import random import sys import re import numpy as np reload(sys) sys.setdefaultencoding('utf-8') from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper,ok,warning,critical,unknown p = PluginHelper() default_url = 'https://api.eveonline.com/server/ServerStatus.xml.aspx/' p.parser.add_option('--url', dest='url', default=default_url) p.parse_arguments() p.show_legacy = True try: html = requests.get(p.options.url).content except Exception, e: p.status(unknown) p.add_summary("%s error encountered while trying to connect to EVE api: %s" % (type(e), e)) p.exit() soup = BeautifulSoup(html)
from dateutil.parser import parse import requests import sys import time from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper,ok,warning,critical,unknown reload(sys) sys.setdefaultencoding('utf-8') helper = PluginHelper() helper.parse_arguments() now = time.time() url = 'http://www.einkamal.is' html = requests.get(url).content soup = BeautifulSoup(html) tables = soup.find('div', {'class':'welcomemsg'}) p = tables.findAll('p') li = soup.find('li',{'class':'accounts'}) active_accounts = li.find('b').text active_accounts = active_accounts.replace('.','') li = soup.find('li',{'class':'active'}) logged_in = li.find('b').text
# # You should have received a copy of the GNU General Public License # along with check_snmp_raritan.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module import sys import os import math import netsnmp sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data, walk_data from pynag.Plugins import PluginHelper, ok, warning, critical, unknown # Create an instance of PluginHelper() helper = PluginHelper() # define the command line options add_common_options(helper) helper.parser.add_option( '-t', help="The type you want to monitor (inlet, outlet, sensor)", default="inlet", dest="typ") helper.parser.add_option( '-i', help="The id of the outlet / sensor you want to monitor (1-99)", default="1", dest="id") helper.parse_arguments()
# along with check_snmp_time2.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module from pynag.Plugins import PluginHelper,ok,unknown import netsnmp import sys import os import time import datetime import struct sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data #Create an instance of PluginHelper() helper = PluginHelper() #Define the command line options add_common_options(helper) helper.parser.add_option('-o', '--tzoffset', dest = 'tzoffset', default = 0, type = 'int', help = 'the local systems utc offset to the servers utc, in minutes (use only if your remote device is in a different timezone)') helper.parser.add_option('-l', '--localtime', dest = 'time_flag', default = False, action = "store_true", help = 'force to use local time (only recommended if you have a non Windows OS remote device, that returns localtime and not utc)') helper.parse_arguments() #Get the options host, version, community = get_common_options(helper) o_tzoff = helper.options.tzoffset use_local = helper.options.time_flag
# check_load.py - Check load average. Thresholds can be specified from the commandline # Import PluginHelper and some utility constants from the Plugins module from pynag.Plugins import PluginHelper,ok,warning,critical,unknown # Create an instance of PluginHelper() helper = PluginHelper() # Optionally, let helper handle command-line arguments for us for example --threshold # Note: If your plugin needs any commandline arguments on its own (like --hostname) you should add them # before this step with helper.parser.add_option() helper.parse_arguments() # Here starts our plugin specific logic. Lets try to read /proc/loadavg # And if it fails, we exit immediately with UNKNOWN status try: content = open('/proc/loadavg').read() except Exception, e: helper.exit(summary="Could not read /proc/loadavg", long_output=str(e), exit_code=unknown, perfdata='') # We have read the contents of loadavg file. Lets put it in the summary of our plugin output: helper.add_summary("Load: %s" % content) # Read metrics from /proc/loadavg and add them as performance metrics load1,load5,load15,processes,last_proc_id = content.split() running,total = processes.split('/') # If we so desire we can set default thresholds by adding warn attribute here
from dateutil.parser import parse import requests import sys import time from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper,ok,warning,critical,unknown reload(sys) sys.setdefaultencoding('utf-8') helper = PluginHelper() helper.parse_arguments() helper.show_legacy = True now = time.time() url = 'http://hraun.vedur.is/ja/skjalftar/skjlisti.html' html = requests.get(url).content soup = BeautifulSoup(html) tables = soup.findAll('table') earthquakes = tables[2] rows = earthquakes.findAll('tr') header_row = rows.pop(0) lines = [] recent_earthquakes = 0 major_earthquakes = 0
import requests import string import random import sys import re import numpy as np reload(sys) sys.setdefaultencoding('utf-8') from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper,ok,warning,critical,unknown p = PluginHelper() chars = string.letters + string.digits randomstring= ''.join([random.choice(chars) for i in xrange(4)]) # avoid cache default_url = 'http://www3.vegag.is/faerd/linurit/vedur.htm' p.parser.add_option('--url', dest='url', default=default_url) p.parser.add_option('--vedurstod', dest='vedurstod', default=None) p.show_legacy = True p.parse_arguments() html = requests.get(p.options.url).content # We are going to parse the html and look for lines like these: #example = """ #<a href="st001.html">Hellisheiði</a> 16.07 22:20 SV 5 ( 7) 7 8 100% 45 6958 #<a href="st031.html">Þrengsli</a> 16.07 22:20 SSV 3 ( 4) 8 11 100% 12 1117 #"""
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_port.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module import sys import os import netsnmp sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, walk_data from pynag.Plugins import PluginHelper, ok, warning, critical, unknown # Create an instance of PluginHelper() helper = PluginHelper() # Add command line parameters add_common_options(helper) helper.parser.add_option('-p', '--port', dest='port', help='The port you want to monitor', type='str', default='') helper.parser.add_option('-s', '--scan', dest='scan_flag', default=False, action="store_true", help='Show all open ports')
def main(): p = PluginHelper() # Warn on inactive level = 2 service_status = get_service_status(sys.argv[1]) if loaded(service_status)[0] is False: p.exit(3, "%s - %s" % (service_status['name'], loaded(service_status)[1]), "\n" + service_status['unparsed']) active = service_status['headers']['Active'][0] if active.startswith("inactive") or active.startswith('failed'): p.add_status(level) elif active.startswith("active"): p.add_status(0) else: p.add_status(3) p.add_summary("%s - %s" % (service_status['name'], active)) p.add_long_output("\n" + service_status['unparsed']) p.exit()
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_ubiquiti.py. If not, see <http://www.gnu.org/licenses/>. # Imports from pynag.Plugins import PluginHelper,ok,warning,critical,unknown import commands, sys, argparse, math import netsnmp import os import datetime sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data # Create an instance of PluginHelper() helper = PluginHelper() # Define the command line options add_common_options(helper) helper.parser.add_option('-t', '--type', dest='power_Status', help='Select a Type, for a list of all possible Types use the argument -l') helper.parser.add_option('-l', '--list', dest='listFlag', default='False', action='store_true', help='Lists all output possibilities') helper.parse_arguments() status = helper.options.power_Status flag_list = helper.options.listFlag host, version, community = get_common_options(helper) names = ["up", "signal", "cpu1m", "cpu5m", "cpu15m", "totalmem", "freemem", "tx", "rx"] descriptions=["Uptime", "Signal Strength", "CPU usage (1 Minute Average)", "CPU usage (5 Minute Average)",
#!/usr/bin/env python # # This script check volcano eruption status in iceland # # from PIL import Image from collections import defaultdict from pynag.Plugins import PluginHelper,ok,warning,critical,unknown import requests import cStringIO url = 'http://hraun.vedur.is/ja/eldgos/volcano_status.png' p = PluginHelper() p.parse_arguments() p.show_legacy = True tmp = requests.get(url) image_file = cStringIO.StringIO(tmp.content) image = Image.open(image_file) p.add_summary("Volcano data last updated: %s." % (tmp.headers['last-modified'])) width = image.size[0] height = image.size[1] colormap = defaultdict(int)
#!/usr/bin/env python # Built on boilerplate form pynag: # https://github.com/pynag/pynag/wiki/Writing-Plugins-with-pynag.Plugins.PluginHelper # Example usage: # python pynag2.py -s WARNING --th metric=some-metrics,ok=0..5,warning=5..10,critical=10..inf #Modules from pynag.Plugins import PluginHelper, ok, warning, critical, unknown helper = PluginHelper() # Arguments helper.parser.add_option("-s", help="Exit State", dest="state", default='OK') helper.parse_arguments() if helper.options.state == "OK": helper.status(ok) elif helper.options.state == "WARNING": helper.status(warning) elif helper.options.state == "CRITICAL": helper.status(critical) elif helper.options.state == "UNKNOWN": helper.status(unknown) else: print "No state specified, calculating from input metrics." helper.add_metric(label='some-metrics', value=5) helper.add_summary("Some status message.")
results_array.append({ 'ip_address': str(destination), 'rtt': 0.0 }) result['success'].update({'results': results_array}) rtt = re.search( r'.* = (?P<rtt_min>\d+)\/(?P<rtt_avg>\d+)\/(?P<rtt_max>\d+).*', output, re.MULTILINE) if rtt: result['success']['rtt_min'] = float(rtt.group('rtt_min')) result['success']['rtt_avg'] = float(rtt.group('rtt_avg')) result['success']['rtt_max'] = float(rtt.group('rtt_max')) return result helper = PluginHelper() helper.parser.add_option("-H", help="Host to connect to (default: %default)", dest="host", default='localhost') helper.parser.add_option("-l", help="Username to login with", dest="username") helper.parser.add_option("-p", help="Password to login with", dest="password") helper.parser.add_option("--dest", help="Destination to ping (default: %default)", dest="destination", default="localhost") helper.parser.add_option("--source", help="Source address or interface to ping from", dest="source") #helper.parser.add_option("--ttl", help="TTL to set (default: %default)", dest="ttl", default=255) # not implemented on Cisco IOS helper.parser.add_option(
class testPluginHelper(unittest.TestCase): def setUp(self): self.argv_store = sys.argv from pynag.Plugins import PluginHelper self.my_plugin = PluginHelper() self.my_plugin.parser.add_option('-F', dest='fakedata', help='fake data to test thresholds') sys.stdout = StringIO() def tearDown(self): sys.argv = self.argv_store sys.stdout = original_stdout def run_expect(self, case, value, expected_exit): sys.argv = [sys.argv[0]] + case.split() + ('-F %s' % value).split() self.my_plugin.parse_arguments() self.my_plugin.add_status(pynag.Plugins.ok) self.my_plugin.add_summary(self.my_plugin.options.fakedata) self.my_plugin.add_metric('fakedata', self.my_plugin.options.fakedata) try: self.my_plugin.check_all_metrics() self.my_plugin.exit() except SystemExit, e: self.assertEquals(type(e), type(SystemExit())) self.assertEquals(e.code, expected_exit) except Exception, e: self.fail('unexpected exception: %s' % e)
# check_dns.py -- Returns OK if a hostname resolves to any ip address # check_dns plugin will need some system libraries for DNS lookup from _socket import gaierror import socket import time # Import PluginHelper and some utility constants from the Plugins module from pynag.Plugins import PluginHelper,ok,warning,critical,unknown # Create an instance of PluginHelper() my_plugin = PluginHelper() # Our Plugin will need -H and -a attributes and we will use PluginHelpers wrapper around optparse for this: my_plugin.parser.add_option('-H', help="Hostname or ip address", dest="hostname") my_plugin.parser.add_option('-a', help="Expected Address", dest="address") # When parse_arguments is called some default options like --threshold and --no-longoutput are automatically added my_plugin.parse_arguments() # # Here starts Plugin-specific logic # # Get the hostname and expected address that was provided on the command-line # address will be optional, but we will throw and error if hostname is not provided hostname = my_plugin.options.hostname address = my_plugin.options.address if hostname is None: my_plugin.parser.error('-H argument is required')
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests import string import random import sys import re import numpy as np reload(sys) sys.setdefaultencoding('utf-8') from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper, ok, warning, critical, unknown p = PluginHelper() chars = string.letters + string.digits randomstring = ''.join([random.choice(chars) for i in xrange(4)]) # avoid cache default_url = 'http://www3.vegag.is/faerd/linurit/vedur.htm' p.parser.add_option('--url', dest='url', default=default_url) p.parser.add_option('--vedurstod', dest='vedurstod', default=None) p.show_legacy = True p.parse_arguments() html = requests.get(p.options.url).content # We are going to parse the html and look for lines like these: #example = """ #<a href="st001.html">Hellisheiði</a> 16.07 22:20 SV 5 ( 7) 7 8 100% 45 6958 #<a href="st031.html">Þrengsli</a> 16.07 22:20 SSV 3 ( 4) 8 11 100% 12 1117
#!/usr/bin/env python import requests from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper,ok,warning,critical,unknown p = PluginHelper() p.parser.add_option('--url', dest='url', default='http://www.vedur.is') p.parse_arguments() html = requests.get(p.options.url).content soup = BeautifulSoup(html) warnings = soup.findAll('div', {'class':'warning'}) p.add_summary('%s warnings are being displayed on vedur.is' % len(warnings)) for i in warnings: p.status(warning) p.add_long_output( i.text ) p.status(ok) p.check_all_metrics() p.exit()
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with check_snmp_service.py. If not, see <http://www.gnu.org/licenses/>. # Import PluginHelper and some utility constants from the Plugins module import sys import os import netsnmp sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, attempt_get_data, walk_data from pynag.Plugins import PluginHelper,ok,critical # Create an instance of PluginHelper() helper = PluginHelper() # Add command line parameters add_common_options(helper) helper.parser.add_option('-s', '--service', help="The name of the service you want to monitor (-s scan for scanning)", dest="service", default='') helper.parser.add_option('-S', '--scan', dest = 'scan_flag', default = False, action = "store_true", help = 'Show all available services') helper.parse_arguments() # get the options host, version, community = get_common_options(helper) service = helper.options.service scan = helper.options.scan_flag # that is the base id base_oid = ".1.3.6.1.4.1.77.1.2.3.1.1"
#!/usr/bin/env python import requests from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper,ok,warning,critical,unknown import simplejson as json p = PluginHelper() p.parser.add_option('--url', dest='url', default='http://api.gulur.is/buses/?geo=true&latitude=64.1251991&longitude=-21.8108419&accuracy=20&range=restOfDay&radius=750000') p.parse_arguments() html = requests.get(p.options.url).content json_data = json.loads(html) buses_running = len(json_data) p.add_metric('buses running', buses_running) p.add_summary('%s buses are currently running' % (buses_running)) print json.dumps(json_data[0], indent=4) p.check_all_metrics() p.exit()
def useSsl(options): return options.keycert != None or options.usessl != None def useSslAuth(options): return options.keycert != None def normalizeRelPath(relpath): path = relpath if relpath.startswith("/"): path = relpath[1:] return path helper = PluginHelper() helper.parser.add_option("-H", help="Host to connect to.", dest="host", default='localhost') helper.parser.add_option("-P", help="Port on the host.", dest="port", default='80') helper.parser.add_option("-U", help="Relative path and query params.", dest="relpath", default='/') helper.parser.add_option("-m",
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with "Health Monitoring Plugins". If not, see <https://www.gnu.org/licenses/>. import sys import os import netsnmp sys.path.insert(1, os.path.join(sys.path[0], os.pardir)) from snmpSessionBaseClass import add_common_options, get_common_options, verify_host, get_data from pynag.Plugins import PluginHelper,ok,warning,critical,unknown # Create an instance of PluginHelper() helper = PluginHelper() # Define the command line options add_common_options(helper) helper.parser.add_option('-U', '--unit', dest='unit', help='Select the unit you want to monitor, if no unit is selected both units will be monitored', default="1") helper.parse_arguments() # get the options host, version, community = get_common_options(helper) unit = helper.options.unit # OIDs from 2082-141.mib.txt unit1_oid = ".1.3.6.1.4.1.31210.52.1.9.0" unit2_oid = ".1.3.6.1.4.1.31210.52.1.13.0" status = {
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This script collects key figure metrics from hagstofan.is from pynag.Plugins import PluginHelper, ok, unknown import requests from BeautifulSoup import BeautifulSoup url = 'http://hagstofan.is' p = PluginHelper() p.parse_arguments() p.show_legacy = True tmp = requests.get(url) html = tmp.content soup = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES) keyfigures_table = soup.find('table', {'class': 'keyfigures_small'}) if not keyfigures_table: p.exit(unknown, "Could not find any table with class=keyfigures_small'") rows = keyfigures_table.findAll('tr') for row in rows: textdata = row.find('td', {'class': 'textdata'}) numberdata = row.find('td', {'class': 'numberdata'}) if not textdata or not numberdata: continue # Get the text content out of the <td> cells
#!/usr/bin/env python # This script connects to hraun.vedur.is and # Graphs all earthquake measures found from dateutil.parser import parse import requests import sys import time from BeautifulSoup import BeautifulSoup from pynag.Plugins import PluginHelper, ok, warning, critical, unknown reload(sys) sys.setdefaultencoding('utf-8') helper = PluginHelper() helper.parse_arguments() helper.show_legacy = True now = time.time() url = 'http://hraun.vedur.is/ja/skjalftar/skjlisti.html' html = requests.get(url).content soup = BeautifulSoup(html) tables = soup.findAll('table') earthquakes = tables[2] rows = earthquakes.findAll('tr') header_row = rows.pop(0) lines = [] recent_earthquakes = 0 major_earthquakes = 0
#!/usr/bin/python # check_snimpy.py - Check arbitrary snmp values using snimpy. Thresholds can be specified from the commandline # Import PluginHelper and some utility constants from the Plugins module from pynag.Plugins import PluginHelper, ok, warning, critical, unknown # Import Snimpy from snimpy.manager import Manager from snimpy.manager import load # Create an instance of PluginHelper() helper = PluginHelper() # Optionally, let helper handle command-line arguments for us for example --threshold # Note: If your plugin needs any commandline arguments on its own (like --hostname) you should add them # before this step with helper.parser.add_option() helper.parser.add_option("-M", help="MIB File", dest="mib", default='IF-MIB') helper.parser.add_option("-V", help="MIB Value", dest="value", default='') helper.parser.add_option("-H", help="Hostname or IP", dest="host", default='localhost') helper.parser.add_option("--Version", help="Snmp Version", dest="version", default='2') helper.parser.add_option("-c", help="Snmp Comunity", dest="community",
# check_snimpy.py - Check arbitrary snmp values using snimpy. Thresholds can be specified from the commandline # Import PluginHelper and some utility constants from the Plugins module from pynag.Plugins import PluginHelper, ok, warning, critical, unknown # Import Snimpy from snimpy.manager import Manager from snimpy.manager import load import re import memcache import time # Create an instance of PluginHelper() helper = PluginHelper() # Optionally, let helper handle command-line arguments for us for example --threshold # Note: If your plugin needs any commandline arguments on its own (like --hostname) you should add them # before this step with helper.parser.add_option() helper.parser.add_option("-n", help="Interface name (regex)", dest="name", default='.') helper.parser.add_option("-H", help="Hostname or IP", dest="host", default='localhost') helper.parser.add_option("--Version", help="Snmp Version",
# # Example usage health: # ./check_springboot_actuator.py -U "http://localhost:14041/testservice/v1/actuator" # # Example usage metrics: # ./check_springboot_actuator.py -U "http://localhost:14041/testservice/v1/actuator" --th "metric=testservice.files.in.failure.value,ok=0..0,warning=1..20,critical=20..inf" -m testservice.files.in.failure from __future__ import print_function import logging from pynag.Plugins import PluginHelper, ok, critical, unknown from requests import get from requests.exceptions import ConnectionError helper = PluginHelper() helper.parser.add_option( '-U', '--url', help='Base URL of Spring Boot Application (default: %default)', dest='url', default='http://localhost:8080') helper.parser.add_option( '-N', '--no-check-certificate', help="don't verify certificate", dest='verify', action='store_false', default=True) helper.parser.add_option( '-t', '--trust-store', help='trust store (PEM format) to use for TLS certificate validation', dest='truststore') helper.parser.add_option( '-m', '--metrics',
# check_snimpy.py - Check arbitrary snmp values using snimpy. Thresholds can be specified from the commandline # Import PluginHelper and some utility constants from the Plugins module from pynag.Plugins import PluginHelper,ok,warning,critical,unknown # Import Snimpy from snimpy.manager import Manager from snimpy.manager import load import re import memcache import time # Create an instance of PluginHelper() helper = PluginHelper() # Optionally, let helper handle command-line arguments for us for example --threshold # Note: If your plugin needs any commandline arguments on its own (like --hostname) you should add them # before this step with helper.parser.add_option() helper.parser.add_option("-n", help="Interface name (regex)", dest="name", default='.') helper.parser.add_option("-H", help="Hostname or IP", dest="host", default='localhost') helper.parser.add_option("--Version", help="Snmp Version", dest="version", default='2') helper.parser.add_option("-c", help="Snmp Comunity", dest="community", default='public') helper.parse_arguments() # Here starts our plugin specific logic. Lets try to read /proc/loadavg # And if it fails, we exit immediately with UNKNOWN status