Varnish Template

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Author
Message
Xumet
Posts: 18
Joined: Thu Mar 16, 2006 12:02 pm

Varnish Template

#1 Post by Xumet » Mon Feb 15, 2010 6:19 am

Hi!

I've made a varnish template based in the "munin" template located in the trunk version. It's a "beta version".

See you
Xavier
Attachments
varnish_template.png
varnish_template.png (18.91 KiB) Viewed 16289 times
VarnishCacti.rar
(28.68 KiB) Downloaded 813 times

glen
Posts: 9
Joined: Sun Oct 05, 2008 10:46 am

version 3

#2 Post by glen » Wed Apr 14, 2010 4:45 pm

i combined templates from this post [1] and script from the other post [2], and built up what i took the liberty to call version 3.

this way i can have many graphs and do not have to play with snmp, don't need to do anything than open port of varnishd.

you may want to upgrade to version 2.1 your varnish, as 2.0 are missing "uptime" column, but all other graphs should be okay. i personally can live without the uptime graph :)

you can download it from here:
http://glen.alkohol.ee/pld/cacti-templa ... h-3.tar.gz

[1] http://forums.cacti.net/viewtopic.php?p=182152
[2] http://forums.cacti.net/viewtopic.php?t=31260

radiumfu
Posts: 8
Joined: Fri Jul 14, 2006 7:18 am
Location: Los Angeles

#3 Post by radiumfu » Mon May 10, 2010 11:44 pm

Thanks a lot, it works on my varnish 2.0.x
cacti/spine is 0.8.7e

ikatkov
Posts: 1
Joined: Fri Sep 17, 2010 5:14 pm

#4 Post by ikatkov » Fri Sep 17, 2010 5:22 pm

Does not work on 2.1.2 Varnish, output format has changed.
To make it worse output format is now different when you connect via telnet or just do varnishstat -1

I've modified script and template to reflect that. Call it version 4 if you like.
The python script no longer connect over telnet, but executes remote ssh command.
Make sure you have private-public key auth setup between cacti and varnish hosts.
Attachments
cacti-template-varnish-4.zip
(33.24 KiB) Downloaded 711 times

adewolf
Posts: 1
Joined: Fri Sep 10, 2010 2:03 pm

#5 Post by adewolf » Fri Sep 24, 2010 12:38 pm

Client OS: CentOS 5.5 64bit
Varnish version: 2.1.2-1
I tried varnish4 and am getting:
09/24/2010 01:30:02 PM - CMDPHP: Poller[0] Host[2] DS[258] CMD: /usr/bin/python /usr/share/cacti/scripts/get_varnish_stats.py -h <host IP>, output: U

I took out the host IP in the above line. Here is what happens when I run the script by hand /usr/bin/python /usr/share/cacti/scripts/get_varnish_stats.py -h hostIP:

client_conn:333121 client_drop:0 client_req:1117404 cache_hit:967173 cache_hitpass:0 cache_miss:97962 backend_conn:67563 backend_unhealthy:0 backend_busy:0 backend_fail:0 backend_reuse:82765 backend_toolate:15228 backend_recycle:97993 backend_unused:0 fetch_head:0 fetch_length:84664 fetch_chunked:13362 fetch_eof:0 fetch_bad:0 fetch_close:16 fetch_oldhttp:0 fetch_zero:44 fetch_failed:10 n_sess_mem:398 n_sess:243 n_object:4796 n_vampireobject:0 n_objectcore:4908 n_objecthead:5660 n_smf:0 n_smf_frag:0 n_smf_large:0 n_vbe_conn:23 n_wrk:121 n_wrk_create:443 n_wrk_failed:0 n_wrk_max:27 n_wrk_queue:0 n_wrk_overflow:2520 n_wrk_drop:0 n_backend:1 n_expired:93042 n_lru_nuked:0 n_lru_saved:0 n_lru_moved:655428 n_deathrow:0 losthdr:582 n_objsendfile:0 n_objwrite:751436 n_objoverflow:0 s_sess:333027 s_req:1117404 s_pipe:52143 s_pass:192 s_fetch:97976 s_hdrbytes:594870970 s_bodybytes:14912987702 sess_closed:122695 sess_pipeline:778 sess_readahead:337 sess_linger:1027598 sess_herd:825124 shm_records:54720521 shm_writes:15965230 shm_flushes:12747563 shm_cont:21143 shm_cycles:27 sm_nreq:0 sm_nobj:0 sm_balloc:0 sm_bfree:0 sma_nreq:199091 sma_nobj:9781 sma_nbytes:114365047 sma_balloc:3565439013 sma_bfree:3451073966 sms_nreq:109 sms_nobj:0 sms_nbytes:0 sms_balloc:53392 sms_bfree:53392 backend_req:98176 n_vcl:1 n_vcl_avail:1 n_vcl_discard:0 n_purge:1 n_purge_add:1 n_purge_retire:0 n_purge_obj_test:0 n_purge_re_test:0 n_purge_dups:0 hcb_nolock:1065060 hcb_lock:52096 hcb_insert:52096 esi_parse:0 esi_errors:0 accept_fail:0 client_drop_late:0 uptime:32972

Does varnishstat return unknown/unparseable data?

Alex DeWolf

User avatar
TheWitness
Developer
Posts: 14817
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#6 Post by TheWitness » Fri Sep 24, 2010 6:51 pm

That's a nasty template. I hate templates that return such long data. It does not make for a scalable system. Make sure that your poller_output table has a width large enough to handle this output result. The command would be:

Code: Select all

alter table poller_output modify column output varchar(????) not null default ''
TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

critbit
Posts: 3
Joined: Thu Sep 23, 2010 4:38 pm

Re: Varnish Template

#7 Post by critbit » Sun Sep 26, 2010 5:26 pm

Also note that spine has a buffer size of 1024 bytes, so my db inserts were getting truncated (to around 919 chars) and failing with MySQL error 1064 :roll:

The same issue exists with the MySQL template, see http://code.google.com/p/mysql-cacti-te ... etail?id=2

Apparently the workaround is to revert to use the cmd.php poller (but, I'd rather not have to do that).

Also - I don't like the ssh + varnishstat method for retrieving this data, when you could just do this:

Code: Select all

varnishadm -T <host IP:port> stats
(varnishadm is shipped with the Varnish source).

I'll be sticking with the previous version of this template for now I think.

User avatar
TheWitness
Developer
Posts: 14817
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Varnish Template

#8 Post by TheWitness » Sun Sep 26, 2010 6:15 pm

There is a spine ./configure option to increase the buffer to whatever you like. Run ./configure --help prior to making. You will see the option there.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

niko2
Posts: 1
Joined: Tue May 24, 2011 5:05 pm

Re: Varnish Template

#9 Post by niko2 » Tue May 24, 2011 5:38 pm

I modified Bashton version http://blog.bashton.com/2009/varnish-ca ... via-cacti/

This version works with varnish 2.1.3 and later for telnet authentication on management port
With the compatibility for the previous versions, if you want to graph both
You can also graph new installations without traffic (I fixed a division by zero bug)
Attachments
cacti-varnish-0.2.tar.gz
(3.81 KiB) Downloaded 521 times

critbit
Posts: 3
Joined: Thu Sep 23, 2010 4:38 pm

Re: Varnish Template

#10 Post by critbit » Sun Sep 18, 2011 7:03 pm

Telnet to management port / varnishadm will not work with Varnish v3.0 - you have to ssh onto the remote machine and issue varnishstat.

I will probably update this some day, unless someone beats me to it (we are not using v3 yet).

chk
Posts: 4
Joined: Fri Jul 16, 2010 8:36 am

Re: Varnish Template

#11 Post by chk » Wed Oct 26, 2011 7:08 am

An update for varnish 3 would be great.

ispavailability
Posts: 25
Joined: Sun Nov 20, 2011 8:45 pm

Re: Varnish Template

#12 Post by ispavailability » Tue Nov 22, 2011 7:49 am

I've been looking into varnish 3 and there is no clean way to get it out remotely.
Im forced to do it now via snmp :-(
Hope something better will come someday.

hanno
Posts: 3
Joined: Thu Nov 24, 2011 6:00 am

Re: Varnish Template

#13 Post by hanno » Thu Nov 24, 2011 6:08 am

@niko2,
we are using varnish 2.1.5-1~lenny4
the python script doesn´t work properly.
secret is set and port is accessable.
our error message:

File "/usr/share/cacti/site/scripts/get_varnish_stats.py", line 48, in <module>
req = req.group(0).split()[0]
AttributeError: 'NoneType' object has no attribute 'group'
ERROR: Not enough arguments

any solution ?

Regards,
Hanno

hanno
Posts: 3
Joined: Thu Nov 24, 2011 6:00 am

Re: Varnish Template

#14 Post by hanno » Thu Nov 24, 2011 8:51 am

Hi,
I found a solution using varnishadm.
http://forums.cacti.net/viewtopic.php?f=12&t=43772
works fine :D
Regards,
Hanno

glen
Posts: 9
Joined: Sun Oct 05, 2008 10:46 am

Re: Varnish Template

#15 Post by glen » Sat Feb 01, 2014 9:10 pm

i've updated template and script to work with varnish3:

https://github.com/glensc/cacti-template-varnish

supports varnish2 as well via "-2" option in poller.

i myself use xinetd, probably other options could be coded as well (ssh, snmp, systemd, ...)

Post Reply