Ad Widget

Collapse

creating user parameters for bandwidth monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • habbers
    Junior Member
    • May 2005
    • 6

    #1

    creating user parameters for bandwidth monitoring

    Hi

    I have a couple of questions regarding bandwidth monitoring for different ethernet devices. I have the zabbix_agent running on a couple of servers and on all but one of them only the lo network device is supported by the zabbix agent. The other devices give a "Not supported by ZABBIX agent". I searched the forums and found some posts regarding creating having to add PerfCounter statements to calculate bandwidth throughput on network devices in Windows but haven't found any mention of that with Linux servers which is what I am trying to monitor. I am a bit confused as to how the keys work and if I have to create a key for my specific network card. I am also uncertain as to how snmp fits into the picture. Is it used by the agent or is it separate?

    From reading this page http://www.zabbix.com/manual_config_items.php I thought that I would just be able to add an item with a key like "netloadin5[eth2]" in order to get the bandwidth stats but all I get is an unsupported message.

    I am monitoring 2 Virtual Private servers which have this as a network device for there external connections: venet0:0? Does anyone know if it is possible to monitor these devices with the Zabbix_agent?

    Thank you for any help
  • cadbury
    Member
    • Apr 2005
    • 77

    #2
    hi habbers

    first, SNMP has completely nothing to do with the zabbix agent or agentd.
    SNMP requests are initiated by the zabbix server, and answered by the client SNMP deamon.
    But in zabbix, to retrieve SNMP values, you have to say the listening port is 161. This make impossible to use both the agent(d) and SNMP on a host. But you can make two hosts, with the same IP, one on port 161, the other on 10050 (the zabbix agent(d) port).
    to see the SNMP MIBs and values, i suggest you a tool such as mbrowse, which display a MIB's tree, and can retrieve values from a host.
    for example, the incoming bytes number since the interfaces are started are under the MIB .1.3.6.1.2.1.2.2.1.10. Make an snmpwalk of this MIB and you will see the values you can get. You will easily find more informations with google, or perhaps you already know it .

    for your virtual devices, if you can see it with ifconfig, you have too the total number of bytes sent and recieved by the interface.
    you can see it for eth2 as well with this kind if command :
    ifconfig eth2 | grep "RX bytes" | cut -d ":" -f 2 | cut -d " " -f 1
    to see the number of recieved bytes. You have to store them as "delta (speed per second)" to see the bandwidth. And
    ifconfig eth2 | grep "TX bytes" | cut -d ":" -f 2 | cut -d " " -f 1
    for the output bandwidth.
    Then you make a UserParameter with that

    hope it can help you

    Clement

    Comment

    • habbers
      Junior Member
      • May 2005
      • 6

      #3
      Thanks for you reply Cadbury. I really don't know anything about SNMP, apart from a vague memory about reading about it in Linux Journal a while ago. I will have to pull out the article and go through it again as it sounds like I need to know about it.

      Thanks for the tips on bandwidth. After a bit of trial and error I have managed to get UserParameters working. I couldn't seem to be able to execute shell scripts as a user paramter but I can just write whatever values I want to a file and then execute cat as a user paramter to read them in. I also found the iptotal command which seems quite useful as a way to read traffic throughput.

      I am using paramters
      UserParameter=venetinTot,/sbin/ifconfig venet0 | grep "RX bytes" | cut -d ":" -f 2 | cut -d " " -f 1
      UserParameter=venetoutTot,/sbin/ifconfig venet0 | grep "TX bytes" | cut -d ":" -f 2 | cut -d " " -f 1
      UserParameter=vnetin5,cat /tmp/traffin5
      UserParameter=vnetout5,cat /tmp/traffout5

      The last 2 user parameters uses scripts like the following to get bandwidth:
      #!/bin/bash

      #Script to measure incoming traffic over 5min period
      #takes current traffic on ethernet device and minus' traffic from 5 min ago
      _newin=`/sbin/ifconfig venet0 | grep "RX bytes" | cut -d ":" -f 2 | cut -d " " -f 1`

      #We check if the in traff was recorded 5 min ago if not we will just say traff for 5 min was 0
      if [ -e /tmp/in ]
      then
      _oldin=`/bin/cat /tmp/in`
      _intraff=`expr $_newin - $_oldin`
      echo $_intraff > /tmp/traffin5
      echo "$_newin" > /tmp/in
      else
      echo "$_newin" > /tmp/in
      echo "0"
      fi

      I don't think I have it quite right yet as my incoming bandwidth and outgoing bandwidth appear to be practically exactly the same, but at least I am starting to realise what you can do with zabbix. It appears to be a great application.

      Comment

      • cadbury
        Member
        • Apr 2005
        • 77

        #4
        this appear to be right, but a bit complicated

        for sure you can see this in SNMP just by retrieving a value
        here is how you can start with snmp :

        the package to install is named net-snmp
        it contains snmpd (the snmp daemon) generally it is here but not installed as a running daemon, because the package also contains snmp clients :
        snmpget
        snmpwalk
        for the most importants
        i also suggest you to install mBrowse, which is a graphic MIB browser.

        a little definitions :
        SNMP is the name of the network protocol
        when a request come to a server, snmpd retrieve (or set, depends on the command) the value in the concerned MIB. MIB stands for Management Information Base. It is the databases where are stocked the values.

        for example :
        snmpwalk 192.168.0.1 -v 1 -c public .1.3.6.1.2.1.2.2.1.2
        return you the list of available network interfaces :
        IF-MIB::ifDescr.1 = STRING: BRI0/0
        IF-MIB::ifDescr.2 = STRING: Ethernet0/0
        IF-MIB::ifDescr.3 = STRING: Serial0/0
        IF-MIB::ifDescr.4 = STRING: BRI0/0:1
        IF-MIB::ifDescr.5 = STRING: BRI0/0:2
        IF-MIB::ifDescr.6 = STRING: Serial1/0
        IF-MIB::ifDescr.7 = STRING: Serial1/1
        IF-MIB::ifDescr.8 = STRING: Serial1/2
        IF-MIB::ifDescr.9 = STRING: Serial1/3
        IF-MIB::ifDescr.14 = STRING: Dialer1
        IF-MIB::ifDescr.15 = STRING: Dialer2

        this gives you two informations : the name of the interface, and the number of the sub-MIB.
        Here, eth0 is the number 2. If I want input bytes of eth0, I have to retrieve .1.3.6.1.2.1.2.2.1.10.2 . for serial1, it is .1.3.6.1.2.1.2.2.1.10.6 .
        the output bytes are under .1.3.6.1.2.1.2.2.1.16
        mBrowse can help you a lot for this. snmpwalk too.

        snmpget retrieve juste the value of a leaf of the MIB tree. snmpwalk retrieve all the values that are under a branch, or the value of a leaf.

        snmpd is as easy to configure as a non-configurable hub
        : echo "rocommunity public" > /etc/snmp/snmpd.conf
        that's all you need to begin

        and yes zabbix is great
        but would be greater with a plug-in oriented architecture, a bit like nagios.

        Comment

        Working...