How to get interface names for check_snmp_int.pl script -n parameter?

  • I have enabled the below perl script for icinga2 to check network bandwidth:


    Code
    1. /usr/lib/nagios/plugins/check_snmp_int.pl


    The problem now is that when I use the below config in my hosts.conf file:


    Code
    1. vars.int["eth0"] = {
    2. int = "eth0"
    3. community = "jhsbdjfhbsd"
    4. address = "172.16.131.17"
    5. }

    It gives the error of "eth0" is unknown. I even tried GigabitEthernet0/0 or 0/1...


    Now I'm stuck. Isn't there a way retrieve network cards automatically. Or what should I use for "int" param?

  • Can you please show the service apply ?


    We can not guess how the current service looks like.

  • Can you please show the service apply ?


    We can not guess how the current service looks like.

    This is the service I user:

    Code
    1. apply Service "Iftraffic: " for (int => config in host.vars.int){
    2.     import "generic-service"
    3.     check_command = "check_iftraffic"
    4.     vars += config
    5.     assign where host.vars.int
    6. }


    And this is the command I use:

  • You can try to do a snmpwalk to find out all interfaces.


    Code
    1. snmpwalk -v2c -csomecommunity so.me.ip.ad ifDescr

    you need to replace the ip address and the community.


    Now I'm stuck. Isn't there a way retrieve network cards automatically. Or what should I use for "int" param?

    Depends on what you want to monitor.

    Just do a snmpwalk to find out how the interfaces are named.


  • Thank you for your response. I used snmpwalk but the error below raised:


    Code
    1. ifDescr: Unknown Object Identifier (Sub-id not found: (top) -> ifDescr)

    The code I used was:


    Code
    1. snmpwalk -v2c -cMY_COMMUNITY_STRING 172.16.131.130 ifDescr
  • It seems that you want to monitor a special network device.


    Can you please add the type of device ?



    Maybe you can find it you with the following command:

    Code
    1. snmpget -v2c -cMY_COMMUNITY_STRING 172.16.131.130 sysDescr.0
  • Why you dont use check_nwc_health to get the names (and or traffic usage) ?


    Code
    1. [root@koelin01 ~]# /usr/lib64/nagios/plugins/check_nwc_health --host localhost --mode list-interfaces
    2. 000001 lo
    3. 000002 ens3
    4. OK - have fun
    5. [root@koelin01 ~]# /usr/lib64/nagios/plugins/check_nwc_health --host localhost --mode interface-usage --name ens3
    6. OK - interface ens3 usage is in:0.00% (10795.06bit/s) out:0.00% (15988.94bit/s) | 'ens3_usage_in'=0.00%;80;90;0;100 'ens3_usage_out'=0.00%;80;90;0;100 'ens3_traffic_in'=10795.06;800000000;900000000;0;1000000000 'ens3_traffic_out'=15988.94;800000000;900000000;0;1000000000
  • Thank you for your response. I cloned the git repo and stuck at autoreconf command. the repo does not have such a file and I don't have such a command! What is autoreconf? How should I run it?

  • Thank you for your response. I cloned the git repo and stuck at autoreconf command. the repo does not have such a file and I don't have such a command! What is autoreconf? How should I run it?

    depending on your OS you have to install it. for Centos just do yum install autoconf


    If you have Centos you can also take a peek at my wiki,use monitoring-portal as user and pwd

  • Phew it is installed now and it works, but I've got a new problem, when I run your command with localhost as below I get timed out error:


    Code
    1. ./check_nwc_health --host localhost --mode list-interfaces

    I tried it with 127.0.0.1 too, but again I got the below error:


    Code
    1. UNKNOWN - check_nwc_health timed out after 15 seconds

    My OS is debian. I installed autoreconf with sudo apt-get install dh-autoreconf and installed the plugin successfully.