Ad Widget

Collapse

Cacti > Varnish to Zabbix > Varnish

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cirrhus9.com
    Member
    • Feb 2012
    • 58

    #1

    Cacti > Varnish to Zabbix > Varnish

    I have ZBX_VER 1.8.10 installed.
    We have a recent need to consolidate our Cacti/Icinga installations and replace them with Zabbix.

    Can do, will do.
    One problem...
    I am now searching for a varnish hit/miss template and accompanying graph to use in Zabbix.
    I have a working .py script from my Cacti host.

    Is this output from that Cacti graph something I can use to create my own in Zabbix?
    Code:
    DS:varnish_requests:COUNTER:600:0:U \
    DS:varnish_hitrate:GAUGE:600:0:100 \
    DS:varnish_hits:COUNTER:600:0:U \
    DS:varnish_misses:COUNTER:600:0:U \
    RRA:AVERAGE:0.5:1:500 \
    RRA:AVERAGE:0.5:1:600 \
    RRA:AVERAGE:0.5:6:700 \
    RRA:AVERAGE:0.5:24:775 \
    RRA:AVERAGE:0.5:288:797 \
    RRA:MAX:0.5:1:500 \
    RRA:MAX:0.5:1:600 \
    RRA:MAX:0.5:6:700 \
    RRA:MAX:0.5:24:775 \
    RRA:MAX:0.5:288:797 \
    
    RRDTool Command:
    
    /usr/bin/rrdtool graph - \
    --imgformat=PNG \
    --start=-86400 \
    --end=-300 \
    --title='ftbvarnish - Varnish - Requests' \
    --base=1000 \
    --height=120 \
    --width=500 \
    --alt-autoscale-max \
    --lower-limit=0 \
    --vertical-label='requests' \
    --slope-mode \
    --font TITLE:12: \
    --font AXIS:8: \
    --font LEGEND:10: \
    --font UNIT:8: \
    --x-grid MINUTE:30:HOUR:2:HOUR:2:0:"%l%p" \
    DEF:a="/var/www/cacti2/rra/ftbvarnish_varnish_requests_19.rrd":varnish_requests:AVERAGE \
    DEF:b="/var/www/cacti2/rra/ftbvarnish_varnish_requests_19.rrd":varnish_hits:AVERAGE \
    DEF:c="/var/www/cacti2/rra/ftbvarnish_varnish_requests_19.rrd":varnish_misses:AVERAGE \
    AREA:a#00CF00FF:"Requests"  \
    AREA:b#002A97FF:"Hits"  \
    AREA:c#FF0000FF:"Misses\n"  \
    GPRINT:a:AVERAGE:"  Request avg\:%8.2lf%s"  \
    GPRINT:b:AVERAGE:"Hit avg\:%8.2lf%s"  \
    GPRINT:c:AVERAGE:"Miss avg\:%8.2lf%s"
    Are Munin Templates importable into Zabbix? There seems to be a varnish template for that package...
    I have read that Munin templates/Exports work in Zabbix via import?

    Are Cacti Templates/Exports importable into Zabbix?

    Any other Templates/Exports from any other package(s).

    I'd hate to re-invent the wheel and I don't want a 'hack', but using pre-existing code|template|boilerplate (with minimal code rewrites) would be great.
    Maybe an Apache Template hack?

    If I have to code my own from scratch, I will. Don't make me come over "there"

    I have done a cursory read at the following links:

    http://www.zabbix.com/wiki/old/blog/federico
    http://www.zabbix.com/wiki/templates/start

    and searched the forums for varnish-related threads.

    Thank you for your time.

    Edit:
    Found this
    Last edited by cirrhus9.com; 29-02-2012, 19:32.
  • cirrhus9.com
    Member
    • Feb 2012
    • 58

    #2
    bump?

    No one here monitors any varnish hosts?

    Comment

    • nated
      Junior Member
      • Apr 2009
      • 5

      #3
      Varnish template

      I'm attaching a varnish template I created a while back. It doesn't have any triggers but the items and graphs should get you going. It requires this UserParameter in your zabbix_agentd.conf:

      UserParameter=varnish.stats[*],printf "stats\nquit\n" | nc 127.0.0.1 6082 | egrep " $1\$" | sed "s/^ *\([0-9]*\) .*/\1/"

      As you can see it also depends on netcat (nc). Let me know how it works for you and if you have any improvements
      Attached Files
      Last edited by nated; 05-03-2012, 08:09. Reason: fixed attachment

      Comment

      • cirrhus9.com
        Member
        • Feb 2012
        • 58

        #4
        Thanks nated!

        Comment

        • victorhugopa
          Member
          Zabbix Certified Specialist
          • Apr 2010
          • 66

          #5
          I created this template to get Requests/s, Cache hits/s, Cache misses/s and calculate Hitrate avg %.

          UserParameter=varnish.stat[*],(varnishstat -1 -f $1 | awk '{print $$3}')

          I attached a graph.

          []'s
          _pUNx_
          Attached Files

          Comment

          • cirrhus9.com
            Member
            • Feb 2012
            • 58

            #6
            Thanks _pUNx_!

            I added
            Code:
            UserParameter=varnish.stat[*],(varnishstat -1 -f $1 | awk '{print $$3}')
            to zabbix_agentd.conf and bounced the service.
            But importing the .xml file doesn't appear to work. It returns a blank page and I let it run a full 5 minutes, just in case.

            Also:
            [root@zabbix-server ~]# zabbix_get -s IPA.DDR.ESS > -p 10050 "varnish.stats" or
            [root@zabbix-server ~]# zabbix_get -s IPA.DDR.ESS > -p 10050 "mysql.version" or
            [root@zabbix-server ~]# zabbix_get -s IPA.DDR.ESS > -p 10050 "mysql.qps"
            and yes they are uncommented on the client host.

            returns without any data?
            Last edited by cirrhus9.com; 06-03-2012, 18:38.

            Comment

            • victorhugopa
              Member
              Zabbix Certified Specialist
              • Apr 2010
              • 66

              #7
              Code:
              zabbix_get -s IPA.DDR.ESS -k varnish.stat[cache_hit]
              zabbix user has permission to run varnishstat?

              ps: sorry my english

              Comment

              • cirrhus9.com
                Member
                • Feb 2012
                • 58

                #8
                Originally posted by _pUNx_
                Code:
                zabbix_get -s IPA.DDR.ESS -k varnish.stat[cache_hit]
                zabbix user has permission to run varnishstat?
                Does now.

                Your English is fine btw.

                Code:
                zabbix_get -s IPA.DDR.ESS -k varnish.stat[cache_hit]
                Same as before, no output.

                Edit:
                Found this:

                (EnableRemoteCommands=1)

                Code:
                zabbix_get -s xx.xxx.xx.xxx -p 10050 -k varnish.stat[cache_hit]
                8.39
                Code:
                 zabbix_get -s xx.xxx.xx.xxx -p 10050 -k varnish.stat[cache_miss]
                36.50

                Progress !!

                Thanks!
                Last edited by cirrhus9.com; 06-03-2012, 20:30.

                Comment

                • cirrhus9.com
                  Member
                  • Feb 2012
                  • 58

                  #9
                  blank after importing, bummer.

                  See http://www.zabbix.com/forum/showthread.php?t=25344

                  I am afraid I will need some hand-holding on this one, or a simple
                  Reader's Digest (cookbook) step through?

                  Solved.
                  Last edited by cirrhus9.com; 08-03-2012, 02:05.

                  Comment

                  • cirrhus9.com
                    Member
                    • Feb 2012
                    • 58

                    #10
                    Originally posted by _pUNx_
                    I created this template to get Requests/s, Cache hits/s, Cache misses/s and calculate Hitrate avg %.

                    UserParameter=varnish.stat[*],(varnishstat -1 -f $1 | awk '{print $$3}')

                    I attached a graph.

                    []'s
                    _pUNx_
                    _pUNx_:
                    What version of varnish is the applicable to?

                    If I use
                    "UserParameter=varnish.stat[*],(varnishstat -1 -f $1 | awk '{print $$3}')"
                    I get zero returned data
                    so I made it
                    UserParameter=varnish.stat[*],(varnishstat -1 -f $1 | awk '{print $$2}')

                    I have varnish-3.0.2 revision cbf1284 on the target/host and a zbx_server 1.8.10

                    What version of zbx did the .xml file come off of? I attempt to import it and all I get is a blank.

                    Thanks you for your time.

                    Comment

                    Working...