Page 1 of 1

openwrt and nagios

Posted: Sun Apr 26, 2020 10:59 am
by jordanthompson
I finally got around to getting Nagios 4 running on my raspberry pi.
I am trying to get it to communicate with my openwrt router.
I have added SNMPd and SNMP-MIBS to the router.
From the pi I can run

Code: Select all

snmpwalk -v1 -c public router
and I get a ton of information back.
I added this router to my Nagios configuration:

Code: Select all

###############################################################################
# SWITCH.CFG - SAMPLE CONFIG FILE FOR MONITORING A SWITCH
#
#
# NOTES: This config file assumes that you are using the sample configuration
#        files that get installed with the Nagios quickstart guide.
#
###############################################################################




###############################################################################
###############################################################################
#
# HOST DEFINITIONS
#
###############################################################################
###############################################################################

# Define the switch that we'll be monitoring

define host{
        use             generic-switch          ; Inherit default values from a template
        host_name       router                  ; The name we're giving to this switch
        alias           OpenWRT Router          ; A longer name associated with the switch
        address         10.13.0.1               ; IP address of the switch
        hostgroups      switches                ; Host groups this switch is associated with
        }




###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################

# Create a new hostgroup for switches

define hostgroup{
        hostgroup_name  switches                ; The name of the hostgroup
        alias           Network Switches        ; Long name of the group
        }




###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################

# Create a service to PING to switch

define service{
        use                     generic-service                 ; Inherit values from a template
        host_name               router                          ; The name of the host the service is associated with
        service_description     PING                            ; The service description
        check_command           check_ping!200.0,20%!600.0,60%  ; The command used to monitor the service
        check_interval          1                               ; Check the service every 5 minutes under normal conditions
        retry_interval          1                               ; Re-check the service every minute until its final/hard state is determined
        }


# Monitor uptime via SNMP

define service{
        use                     generic-service ; Inherit values from a template
        host_name               router
        service_description     Uptime
        check_command           check_snmp!-C public -o sysUpTime.0
        }



# Monitor Port 1 status via SNMP

define service{
        use                     generic-service ; Inherit values from a template
        host_name               router
        service_description     Port 1 Link Status
        check_command           check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB
        }



# Monitor bandwidth via MRTG logs

define service{
        use                     generic-service ; Inherit values from a template
        host_name               router
        service_description     Port 1 Bandwidth Usage
        check_command           check_local_mrtgtraf!/var/lib/mrtg/192.168.1.253_1.log!AVG!1000000,1000000!5000000,5000000!10
        }
I then did:

Code: Select all

/etc/init.d/nagios4 reload
The router is showing up, but there is very little information available from nagios about the router. Am I missing something?