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.

    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:

  • Post by alireza.stack ().

    This post was deleted by the author themselves ().
  • 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