Friday, January 25, 2013

Monitoring Squid with Cacti (Template Cacti for Squid... Complete...!!!)

I assume that you have installed snmp, squid and cacti, before. I will not explain again about how to install squid, snmp, cacti, etc.. there's so many article to discuss about that’s.
Then, if all installation is complete, let's make graph template for squid.

1. cek your squid configuration,
# squid -v
Squid Cache: Version 3.1.22
configure options:  '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/sbin' '--sbindir=/usr/sbin' '--sysconfdir=/etc/squid' '--datadir=/usr/share/squid' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/lib/squid' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--x-includes=/usr/include' '--x-libraries=/usr/lib' '--enable-shared=yes' '--enable-static=no' '--enable-carp' '--enable-storeio=aufs,ufs' '--enable-removal-policies=heap,lru' '--enable-icmp' '--disable-delay-pools' '--disable-esi' '--enable-icap-client' '--enable-useragent-log' '--enable-referer-log' '--disable-wccp' '--enable-wccpv2' '--disable-kill-parent-hack' '--enable-snmp' '--enable-cachemgr-hostname=localhost' '--enable-arp-acl' '--disable-htcp' '--disable-forw-via-db' '--disable-follow-x-forwarded-for' '--enable-cache-digests' '--disable-poll' '--enable-epoll' '--enable-linux-netfilter' '--disable-ident-lookups' '--enable-default-hostsfile=/etc/hosts' '--with-default-user=squid' '--with-large-files' '--enable-mit=/usr' '--with-logdir=/var/log/squid' '--enable-http-violations' '--enable-zph-qos' '--with-filedescriptors=65536' '--enable-gnuregex' '--enable-async-io=64' '--with-aufs-threads=64' '--with-pthreads' '--with-aio' '--enable-default-err-languages=English' '--enable-err-languages=English' '--disable-hostname-checks' '--enable-underscores' --with-squid=/usr/local/squid-3.1.22 --enable-ltdl-convenience

If there’s no option '--enable snmp', you must reconfigure squid.

2.   Cek file /etc/squid/squid.conf
 Squid.conf usually located at /etc/squid/.  Make sure, some line below is exist.
acl bamboe src
acl snmppublic snmp_community public
snmp_port 3401
snmp_access allow snmppublic bamboe
snmp_access deny all
3. Test your snmp with snmpwalk
Command :snmpwalk  communitystring -v1 hostname:3401 .
for example, in my case,
snmpwalk -c public -v1
4. Add one line below to file /etc/snmp/snmpd.conf
proxy -v1 -c your_community_string hostname:3401 .
for example, in my case,
proxy -v1 -c public .
5. Download template cacti

It was not me who made it. Thanks to the person who first made the script template. :)

6. Configure Cacti
  • Open Cacti and login as admin. Click Console > Import Templates.
cacti - console - import templates
  • In page Import templates,  Click Browse/Telusuri. Find the file template that you downloaded earlier. Then click import.
cacti - import template
  • Now you will be back to page console. Click Console > Devices > Add.
 cacti add devices
  • In page Device[New]. Fill the blank rectanguler in accordance with the your computer (squid). Then click Create, at the right bottom.
cacti create new devices
  • Console > Device > [Name Device that you have created]
cacti - device
  • Click Add Graph Template, find graph that you want, and click Add
cacti - add graph template 
  • You will be back again to console. Console > New Graph. Find the host proxy squid. Then check graph template name that you want to create. And then, click Create, at the right bottom.
 cacti - console - new graphs
  • Done. Let's take a look at the chart by clicking Graph. Wait 5 - 10 minutes, till you see the graph. There's so many button setting to view the graph, you can explore that's all by yourself.
cacti capture graphs


  1. here my squid3 config
    squid3 -v
    Squid Cache: Version 3.3.8
    configure options: '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--libexecdir=${prefix}/lib/squid3' '--srcdir=.' '--disable-maintainer-mode' '--disable-dependency-tracking' '--disable-silent-rules' '--datadir=/usr/share/squid3' '--sysconfdir=/etc/squid3' '--mandir=/usr/share/man' '--enable-ssl' '--enable-ssl-crtd' '--enable-snmp' '--enable-inline' '--enable-async-io=8' '--enable-storeio=ufs,aufs,diskd,rock' '--enable-removal-policies=lru,heap' '--enable-delay-pools' '--enable-cache-digests' '--enable-underscores' '--enable-icap-client' '--enable-follow-x-forwarded-for' '--enable-auth-basic=DB,fake,getpwnam,LDAP,MSNT,MSNT-multi-domain,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB' '--enable-auth-digest=file,LDAP' '--enable-auth-negotiate=kerberos,wrapper' '--enable-auth-ntlm=fake,smb_lm' '--enable-external-acl-helpers=file_userip,kerberos_ldap_group,LDAP_group,session,SQL_session,unix_group,wbinfo_group' '--enable-url-rewrite-helpers=fake' '--enable-eui' '--enable-esi' '--enable-icmp' '--enable-zph-qos' '--enable-ecap' '--disable-translation' '--with-swapdir=/var/spool/squid3' '--with-logdir=/var/log/squid3' '--with-pidfile=/var/run/' '--with-filedescriptors=65536' '--with-large-files' '--with-default-user=proxy' '--enable-linux-netfilter' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall' 'LDFLAGS=-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security'

    it's says..
    /etc/squid3/squid.conf:64 unrecognized: 'proxy'

    1. there is no user proxy... make sure about this...

    2. I'm edit wrong file, proxy is for /etc/snmp/snmpd.conf not /etc/squid/squid.conf sorry for my confusion.

  2. Get daily suggestions and guides for making $1,000s per day FROM HOME for FREE.

  3. The best facts about Clixsense's Get Paid To Program:
    1. SURVEYS: 50+ 5-40 minute surveys paying out $0.50-$2.50 per survey.
    2. 12 Offer Walls - Make $0.5-$20 per offer.
    3. TASKS - Complete 1,000's of small tasks from tons companies.