Monitor RTT values with Nagios?



  • Today we experienced an abnormally high RTT value on the Gateway. How is this RTT time calculated? What is it calculated against? We would like to setup Nagios alerts for this. Any idea how to get this going to monitor the RTT? Thanks.


  • Rebel Alliance Developer Netgate

    That is tracked by apinger and there wouldn't be a way for Nagios to see that normally.

    I suppose you could setup a command in nrpe2 to grab the gateway status from /tmp/apinger.status and report it back to Nagios. Not sure anyone has done that before though.



  • @jimp:

    That is tracked by apinger and there wouldn't be a way for Nagios to see that normally.

    I suppose you could setup a command in nrpe2 to grab the gateway status from /tmp/apinger.status and report it back to Nagios. Not sure anyone has done that before though.

    Ok I built an easy plugin for Nagios to monitor this service. Mostly just bash command with cut to provide status code of 0/1/2

    Where do I put the plugin on pfSense. It usually comes from the /usr/lib/nagios/plugins directory. I created the directory and dropped the plugin into it. Doesnt appear to work like it usually would under a centos box, etc.


  • Rebel Alliance Developer Netgate

    Not sure about that - I think if you install nrpe2 it should show the command paths in the package settings.



  • @jimp:

    Not sure about that - I think if you install nrpe2 it should show the command paths in the package settings.

    oops. Didn't know that pfSense was already installed to the system and had NRPEv2 option in the web GUI. …Services --> NRPEv2

    For googlers:

    1 - Created plugin -

    
    #!/bin/sh
    
    real_rtt=`cut -f7 -d '|' /tmp/apinger.status | sed s/..$//`
    rtt=`cut -f7 -d '|' /tmp/apinger.status | sed s/......$//`
    isp=`cut -f3 -d '|' /tmp/apinger.status`
    ispIP=`cut -f1 -d '|' /tmp/apinger.status`
    
    if  [ $rtt -lt 50 ]
    then
       echo "Normal - $isp RTT OK for $ispIP : $real_rtt ms"
       stateid=0
    elif [ $rtt -gt 50 ] && [ $rtt -lt 100 ]
    then
       echo "Warning - $isp RTT Increasing for $ispIP : $real_rtt ms"
       stateid=1
    elif [ $rtt -gt 100 ]
    then
       echo "Alert - $isp  RTT Critical for $ispIP : $real_rtt ms"
       stateid=2
    fi
    exit $stateid
    

    2 - SCPed plugin to /usr/local/libexec/nagios directory
    3 - pfSense web GUI –> Services --> NRPEv2
    4 - Create new entry with check_pfsense_gateway_rtt as name and select the same name from plugin drop down menu:
    [attachment image 1]
    5 - add entry to /etc/nagios/services.cfg

    define service{
       use                        basic-service
       service_description        pfSense
       servicegroups              local
       host_name                  pfsensegw1
       check_command              check_nrpe!check_pfsense_gateway_rtt
    }
    

    6 - add hostgroup entry to /etc/nagios/hosts.cfg for the pfsense

    define host{
            use                      basic-host
            host_name                pfsensegw1
            alias                    pfsensegw1
            address                  192.168.1.1
            hostgroups               firewalls,pfsense
            }
    

    7 - add entry to /etc/nagios/commands.cfg

    # pfSense
    define command{
       command_name   check_pfsense_gateway_rtt
       command_line   $USER1$/check_pfsense_gateway_rtt -H $HOSTADDRESS$
    }
    

    8 - service nagios reload
    9 - open nagios and check to see if service appears under your host. In my case "pfsensegw1"
    [attachment image 2]





Log in to reply