Skip to main content

Traper

Grusher support getting and parce SNMP Traps (from build 319). 

You can add all Trap or only needed Trap to control. Of cource you can allow view information about trap on main page on event (message will autoclosed if no change in some period of time). On Event show Trap counter of this problem. 

You can personalise each TRAP to show you own message or custom field.

зображення.png

For this function port 162 must be open

Instalation

First you want to install snmptrapd.

You may install snmptrapd on any server. Data send to Grusher via API

I also recommend going ahead and enabling snmptrapd to start automatically in case of server reboots.

sudo apt install snmptrapd
sudo systemctl enable snmptrapd
Setting Grusher default trap handler

This is default php script used by default.
You can use your own logic, script or soft to get traps and send to Grusher API

Download Grusher TrapHandler files and unpack to /opt/snmptrap_grusher/ or other folder.

Grusher TrapHandler files  https://github.com/gviabcua/grusher_trap_handler

Edit /etc/snmp/snmptrapd.conf

sudo nano /etc/snmp/snmptrapd.conf 

And add data like this

# listen on
disableAuthorization yes
agentaddress my_ip_address:162
# set php-snmptraps as default trap handler
traphandle default /usr/bin/php /opt/snmptrap_grusher/traphandler.php

Reboot service

 sudo service snmptrapd restart

Now you can get traps from devices

You need to configure you device to send SNMP traps on your server

In folder /opt/snmptrap_grusher/ present config file and ignore list file to disable spamming.

Sample config file varibles

    // Grusher api key and url
    $GRUSHER_API_KEY = "key";
    $GRUSHER_API_URL = "http://192.168.1.1/api";
    // Allow using ignore list
    $config_use_ignore_list   = true;
    // Writing trap to file (exept trap in ignore list)
    $config_write_trap_to_log = false;
    // log file name
    $config_log_filename      = '/tmp/trap_log.txt';
    // Writing all requests
    $config_write_all_trap_to_log = false;
    // log file name
    $config_all_log_filename      = '/tmp/trap_log_'.date("Y-m-d").'.txt';

Sample ignore list file. All oids in this list will ignored if config allow using ignore list

$config_ignore_list = [
        // GENERAL TRAPS
        'IF-MIB::hwLoadAndBackupTrapsOID',     '1.3.6.1.6.3.1.1.5.0', // hwLoadAndBackupTrapsOID
        'IF-MIB::coldStart',                   '1.3.6.1.6.3.1.1.5.1', // coldStart
        'IF-MIB::warmStart',                   '1.3.6.1.6.3.1.1.5.2', //warmStart
        'IF-MIB::linkDown',                    '1.3.6.1.6.3.1.1.5.3', // linkDown
        'IF-MIB::linkUp',                      '1.3.6.1.6.3.1.1.5.4', //linkUp
        'IF-MIB::authenticationFailure',       '1.3.6.1.6.3.1.1.5.5', //authenticationFailure
        'IF-MIB::egpNeighborLoss',       '1.3.6.1.6.3.1.1.5.6', //egpNeighborLoss
        '1.0.8802.1.1.2.0.0.1', //lldp changed
        // BY DEVICE VENDOR
        //Edge Core
        '1.3.6.1.4.1.259.10.1.45.2.1.0.208', //Edge Core fileCopyTrap
        '1.3.6.1.4.1.259.10.1.27.2.1.0.107', //cpuUtiFallingThreshold
        '1.3.6.1.4.1.259.10.1.27.2.1.0.108', //cpuUtiRisingThreshold
        '1.3.6.1.4.1.259.10.1.27.2.1.0.200', //log in/out
        '1.3.6.1.4.1.259.10.1.27.2.1.0.201', //log in/out
        '1.3.6.1.4.1.259.10.1.27.2.1.0.202', //log in/out
        '1.3.6.1.4.1.259.10.1.27.2.1.0.208', //fileCopyTrap
        .........
];

Setting Grusher

Enabling traper

First of all you need enable getting traps in setting (http://GRUSHER_IP/system/config?option_type=search_param&search_data=monitoring_trap_)

зображення.png

If you turn off "Getting SNMP Traps only added to system" - Grusher will add all getted traps to DB without self filtering

Traps list

This is sample page what show last getted data (if configured)

зображення.png

This is sample page what show last getted data (if NOT configured)

зображення.png

Setting event

You need to add trap what will monitored.

зображення.png

If you don`t know what is OID - use this button for search online

зображення.png

And when click to OID. New form will be open. Configure it as you want

зображення.png

Now you will see like this

зображення.png