Director - monitor 2 interfaces on a switch and draw a visual graph of bandwidth utilization

  • Hi everyone,

    we have been using Icinga 1 for a few years now. We define our core switches , and monitor the two uplinks to the cisco router, which gives us our bandwidth utilization in and out. It is described here:

    https://www.icinga.com/docs/ic…n/monitoring-routers.html

    I would like to rebuild this in icinga2. I have done the installation and would like to use the director to configure this. I have added my first host and I do a hostalive4 check command. I am not sure how to specify the interfaces to be monitored and to draw a visual graph from it. Can anyone assist. Thank you.

  • do you want to monitor them in a single check, or as 2 seperate checks?


    for drawing graphs, you should use InfluxDB and Grafana, there is also a grafana plugin for icingaweb2.

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • Thank for replying guys. Will it make a difference if I check them separate? I am trying to do this with Icingaweb and director. I just love the new interface!!

    I used to have config like this:

    define service{

    use generic-service ; Inherit values from a template

    host_name SOMESWITCH

    service_description Port 45 Link Status

    check_command check_snmp!-C netcare -o ifOperStatus.45 -r 1 -m RFC1213-MIB

    }

    define service{

    use generic-service ; Inherit values from a template

    host_name SOMESWITCH

    service_description Port 44 Link Status

    check_command check_snmp!-C netcare -o ifOperStatus.44 -r 1 -m RFC1213-MIB

    }


    define service{

    use generic-service,srv-pnp ; Inherit values from a template

    host_name SOMESWITCH

    service_description Port 44 Backup Link Bandwidth Usage

    check_command check_local_mrtgtraf!/srv/www/htdocs/mrtg/SOME-IP.log!AVG!1000000,1000000!5000000,5000000!10

    }

  • it does make a slight difference, as you can define those interfaces as a variable in the host and let the apply-rule for the service dynamically handle the creation of the services

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • that is not what I meant.


    You can define those interfaces as an array in the host object and then run an service apply rule against that array, to automagically generate the services.

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • sure, I can give you an example on how it should look. You will have to do legwork yourself.


    1. Add a new datafield called ports and append it to your host template

    2. Fill them with data, so they look something like this: vars.ports = [ "44", "45"]

    3. Add a service template

    4. Define the apply rule, that uses $config$ to fill the parameters.

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • Have done so .... I guess it does not like descriptors for the ports:

    under my output, I get:

    ERROR: Description table : No response from remote host "my switch ip"

  • Side note: You should focus on SNMP and plugins here.


    If you want to do trend and rate calculations, look into possible SNMP plugins too. Or check against your metrics backend (Graphite, InfluxDB, etc.) specifically. MRTG is something no-one uses anymore to my knowledge.

  • Thank you dnsmichi - I have installed the plugins and will prefer Graphite - would just like to get one device up ad running, before trying to add 900 others :)

  • Kevin.Honka is the Director Pro here, I just wanted to clear things up with what tools should be used in the first place. He can better help you with the Director and best practices. Side note - you might want to attend OSMC and hear him talk too :) https://osmc.de/speakers/

  • the tricky part is using the director in such a way. Your initial config is good.


    You need to add a field to the if command.

    The field is predefined, so you can do it easily here:

    Director => Commands => iftraffic => Fields


    The field you will want is most likely this one:

    $iftraffic_interface$


    After that you will see a change to your apply-rule, there should be a field called iftraffic_interface in custom properties.

    Try adding $config$ into it and watch the magic happen :)

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them