Ad Widget

Collapse

Can't monitor network traffic on VPS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marc1911
    Junior Member
    • Oct 2007
    • 14

    #1

    Can't monitor network traffic on VPS

    I've finally Zabbix working on my OpenVZ VPS machines and bumped into the next challange: a network monitoring problem. Why not?

    The eth0 interface isn't supported on a VPS. Instead there's at default a venet0 interface available. Probably the parameters to read out receive and transmit values aren't therefore supported in Zabbix. I could of course parse /proc/net/dev and readout the values myself using Bash or Perl.

    I did some experimenting with Bash and defined on the Agent two UserParameters that did their job perfectly until their was some shifting with positions of the bytes in the /proc/net/dev output.

    UserParameter=venet0.receive, cat /proc/net/dev | grep venet0 | cut -b 9-18
    UserParameter=venet0.transmit, cat /proc/net/dev | grep venet0 | cut -b 67-77

    Before I throw myself into a new subproject advanced programing with Perl or Bash to get this done, I was wondering if there's someone around that already got over this or a similar problem.

    Regards,

    Marc
  • marc1911
    Junior Member
    • Oct 2007
    • 14

    #2
    Ahm..

    Found a solution in using Bash with ifconfig:

    UserParameter=venet0.transmit, ifconfig venet0 | grep "TX bytes" | cut -d ":" -f 2 | cut -d " " -f 1
    UserParameter=venet0.receive, ifconfig venet0 | grep "RX bytes" | cut -d ":" -f 2 | cut -d " " -f 1

    Comment

    • NowVox
      Junior Member
      • Jun 2006
      • 4

      #3
      Monitor venet0 with Zabbix

      Hi guys,

      This is what I'm using with Zabbix 1.4.5 running in an OpenVZ CentOS 5.1 container.

      UserParameter=venet0.transmit, /bin/awk '/venet0/ { print $10 }' /proc/net/dev
      UserParameter=venet0.receive, /bin/awk '/venet0/ { print $2 }' /proc/net/dev

      Works pretty well for me.

      Comment

      • surftimer
        Junior Member
        • Apr 2007
        • 9

        #4
        venet0 traffic

        Worked for me too with this item

        net.if.in[venet0,bytes]

        on a container with Debian Lenny

        and

        UserParameter=venet0.transmit, /usr/bin/awk '/venet0/ { print $10 }' /proc/net/dev
        UserParameter=venet0.receive, /usr/bin/awk '/venet0/ { print $2 }' /proc/net/dev

        Comment

        • ittec
          Member
          • Mar 2008
          • 73

          #5
          Item?

          Hi

          thanks by info. But I don't how exactly I have to create a new item for the two UserParameters. Do I need two or one item?

          Thanks!

          Comment

          • surftimer
            Junior Member
            • Apr 2007
            • 9

            #6
            In this way I have incoming and outgoing traffic ( with both items )
            I have never tested it with only one item

            I did a clone for the existing item , modified it to my needs and saved the new one.
            ( I disabled the one I have cloned because it was not supported)

            hope this helps

            cheers
            Last edited by surftimer; 09-04-2009, 14:02.

            Comment

            • ittec
              Member
              • Mar 2008
              • 73

              #7
              Doubts

              Hi again and thanks to answer.

              I still have doubts about monitor traffic with Zabbix on VPS. I work with CentOS 5.

              Points:

              We request for bytes sended o received throught /proc/net/dev
              We use awk to do a kind of grep and cut and separate the information that we wants

              Example

              -bash-3.2# cat /proc/net/dev

              face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
              venet0:65638139950 190129610 0 0 0 0 0 0 66277758215 202867072 0 0 0 0 0 0

              and inmediatly we do

              -bash-3.2# awk '/venet0/ {print $2}' /proc/net/dev

              190144023

              Perhaps Im wrong but I have the feeling that Im requesting about paquets and not bytes.

              First quest did on venet0 190129610 paquets and awk returns 190144023 so with this UserParameter Im recolleting not the Bytes but the paquets!

              Do you agree??

              Thanks!

              Comment

              • alixen
                Senior Member
                • Apr 2006
                • 474

                #8
                We are monitoring OpenVZ VPS and we haven't defined any UserParameter.

                We get venet0 traffic data with:
                net.if.in[venet0,bytes]
                net.if.out[venet0,bytes]

                Regards,
                Alixen
                http://www.alixen.fr/zabbix.html

                Comment

                • ittec
                  Member
                  • Mar 2008
                  • 73

                  #9
                  Curious

                  Interesting, maybe somebody of forum can explain to us this little mistery

                  Comment

                  • ittec
                    Member
                    • Mar 2008
                    • 73

                    #10
                    Afirmative

                    So yes, I have noticed that's no necessary to setup a UserParameter to monitor traffic. Thanks!

                    Comment

                    • SOaD!
                      Junior Member
                      • Jun 2009
                      • 4

                      #11
                      Originally posted by ittec
                      Interesting, maybe somebody of forum can explain to us this little mistery
                      The UserParameter is defined as venet0.transmit, and the item parameter is venet0.

                      Actually Zabbix is using the built-in function with the venet0 parameter and the UserParameter is never used here.

                      Comment

                      Working...