Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


Nagios Plugins for VTxx checking

Nagios plugin for checking single element (sensor)

Usage:
./check_element.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd) -i <ID> [-P <port>] [-t <timeout>] [-V]

Command line options:

-v, --verbose
    print extra debugging information

-h, --help
    print this help message

-H, --hostname=HOST
    name or IP address of host to check

-C, --community=COMMUNITY NAME
    community name for the host's SNMP agent (implies v 1 protocol)

-P, --port=PORT
    SNMPD port (Default 161)

-2, --v2c
        use SNMP v2 (instead of SNMP v1)

-t, --timeout=INTEGER
    timeout for SNMP in seconds (Default : 5)

...

-i, --id=INTEGER
        element's id

Nagios command configuration example:

commands.cfg
Code Block
languagetext
titlecommands.cfg
define command {
        command_name check_snmp_element
        command_line $USER1$/check_element.pl -H $HOSTADDRESS$ $ARG1$
}

Nagios command using the example (community name: read; element ID: 201001):

services.cfg
Code Block
title
languagetextservices.cfg
define service{
        use                             generic-service    
        # host_name                       test190
        hostgroup_name                  sc-hosts
        contact_groups                  admins
        service_description             Unit Service for element with ID=201001 
        check_command                   check_snmp_element! -C read -i 201001
        normal_check_interval           1
        retry_check_interval            1
        process_perf_data               1
}

Download:

Image Modified

Nagios plugin for checking single element (sensor)

check_element.pl


Nagios plugin for checking the table of elements (sensors)

This plugin generate generates the alarm if at if at least one element is in the alarm, and the warning if at least one element is in the warningelement is in the alarm, and the warning if at least one element is in the warning.
This plugin generate generates the performance data only for sensors with valid value field (as sensors with analog and discrete output)

Usage:
./check_element_table.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd)  [-P <port>] [-t <timeout>] [-V]

-v, --verbose
    print extra debugging information

-h, --help
    print this help message

-H, --hostname=HOST
    name or IP address of host to check

-C, --community=COMMUNITY NAME
    community name for the host's SNMP agent (implies v 1 protocol)

-P, --port=PORT
    SNMPD port (Default 161)

-2, --v2c
     use SNMP v2 (instead of SNMP v1)

...

-V, --version
    prints version number

Nagios command configuration example:

commands.cfg
Code Block
title
languagetextcommands.cfg
define command {
        command_name check_snmp_element_table
        command_line $USER1$/check_element_table.pl -H $HOSTADDRESS$ $ARG1$
}

Nagios command using example (community name: read):

services.cfg
Code Block
languagetexttitleservices.cfg
# SNMP Table of Elements for devices  
define service{
        use                             generic-service    
        # host_name                     test190
        hostgroup_name                  sc-hosts
        service_description             Unit Table of Elements Service 
        check_command                   check_snmp_element_table! -C read
        normal_check_interval           1
        retry_check_interval            1
        process_perf_data               1
}

Download:

Image Modified

Nagios plugin for checking all elements (sensors)

check_element_table.pl

Script for Nagios passive for Nagios passive checking

This script takes parameters from SNMPTT (SNMP Trap Translator) or otherothers, and append appends this to the Nagios passive checking pipechecking pipe.
For install installation put this script to the Nagios plugins/eventhandlers folder
You must be add a template for passive testing to Nagios configuration file, and associate this templateadd a template for passive testing to the Nagios configuration file, and associate this template, for example, with  with a group of hosts:

...

of hosts:

/etc/nagios/objects/schosts.cfg
Code Block
languagetext
##
# Trap
##
define service{
        name                    trap-service
        use                     generic-service
        register                0
        is_volatile             1
        check_command           check-host-alive     ; Used to reset the status to OK when 'Schedule an immediate check of this service' is selected
        flap_detection_enabled  0                    ; Flap detection is disabled
        process_perf_data       0                    ; Do not Process performance data
        max_check_attempts      1
        normal_check_interval   1
        retry_check_interval    1
        passive_checks_enabled  1
        active_checks_enabled   0                    ; Prevent active checks from occuring as we are only using passive checks
        check_period            none
        notification_interval   31536000
        notification_options    w,u,c                ; Notify on warning, unknown and critical
        contact_groups          admins
}

define service{
        use                     trap-service
        service_description     Trap1
        hostgroup_name          sc-hosts
}

Download:

Image Modified

Script

for Nagios

for Nagios passive checking

submit_check_result


Script

...

for Nagios notified by GSM modem of master module

This script provides sending script provides sending notifications from Nagios by by by by GSM modem of the master module.

Usage:
./sendsms -H <host> -p <password> -P <phone number> -m <message> 

-H=hostname

    name or IP address of the host to check

-u=user name
    user name of mater module

-p=password
    password for the user of mater the main module

-P=phone
    phone number of of the recipient

-m=message
    message for sending

For installinstallation, put this script to in the Nagios plugins folder.

Add commands for sms notify SMS notification to Nagios commands file:

...

/etc/nagios/objects/commands.cfg
Code Block
languagetext
define command{
        command_name notify-service-by-sms
        command_line $USER1$/sendsms -H 192.168.1.190 -p guest -P $CONTACTPAGER$ -m "Nagios – $NOTIFICATIONTYPE$ : $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$"
}

define command{
        command_name notify-host-by-sms
        command_line $USER1$/sendsms -H 192.168.1.190 -p guest -P $CONTACTPAGER$ -m "Nagios – $NOTIFICATIONTYPE$ : Host $HOSTALIAS$ is $HOSTSTATE$"
}

Add the Add the notify command for contact to Nagios configuration for contact to the Nagios configuration file as bellowbelow:

...

/etc/nagios/objects/contacts.cfg
Code Block
languagetext
define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user
        service_notification_options    w,u,c,r
        host_notification_options       d,u,r
        service_notification_commands   notify-service-by-email,notify-service-by-sms
        host_notification_commands      notify-host-by-email,notify-host-by-sms
        email                           nagios@localhost        ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        pager                           +329999999999           ; <<***** CHANGE THIS TO YOUR PHONE NUMBER ******
}


Download:

Image Modified

Script

for Nagios notify

for Nagios notified by GSM modem

sendsms


To allow us better support please leave your comments below or on our forum.

...