def setup_plugin_helper(): # Create an instance of PluginHelper() a_helper = pynag.Plugins.PluginHelper() # define the command line options snmpSessionBaseClass.add_common_options(a_helper) # Add all defined check types (dictionary keys) as help text a_helper.parser.add_option( '-t', '--type', dest='type', help="Check type to execute. Available types are: {}".format(", ".join( apc_check_configs.keys())), type='str') a_helper.parser.add_option( '-c', '--critical', dest='critical', help='Critical thresholds in Icinga range format.', type='str') a_helper.parser.add_option( '-w', '--warning', dest='warning', help='Warning thresholds in Icinga range format.', type='str') snmpSessionBaseClass.add_snmpv3_options(a_helper) a_helper.parse_arguments() return a_helper
def setup_plugin_helper(): # Create an instance of PluginHelper() a_helper = pynag.Plugins.PluginHelper() # define the command line options snmpSessionBaseClass.add_common_options(a_helper) # Add all defined check types (dictionary keys) as help text a_helper.parser.add_option('-t', '--type', dest='type', help = "Check type to execute. Available types are: {}".format( ", ".join(apc_check_configs.keys())), type='str') a_helper.parser.add_option('-c', '--critical', dest='critical', help='Critical thresholds in Icinga range format.', type='str') a_helper.parser.add_option('-w', '--warning', dest='warning', help='Warning thresholds in Icinga range format.', type='str') snmpSessionBaseClass.add_snmpv3_options(a_helper) a_helper.parse_arguments() return a_helper
def setup_plugin_helper(): # Create an instance of PluginHelper() a_helper = pynag.Plugins.PluginHelper() # define the command line options snmpSessionBaseClass.add_common_options(a_helper) # Add all defined check types (dictionary keys) as help text a_helper.parser.add_option('-t', '--type', dest='type', help="Check type to execute. Available types are: {}".format( ", ".join(eaton_check_configs.keys())), type='str') snmpSessionBaseClass.add_snmpv3_options(a_helper) a_helper.parse_arguments() if a_helper.options.type: a_helper.options.type = a_helper.options.type.lower() return a_helper
# 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() status = helper.options.power_Status flag_list = helper.options.listFlag
# 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" ''' # for check_snmp_service we need to adapt the service_get_data function