Glen Pitt-Pladdy :: Blogvmstat on Cacti via SNMP | |||
After a long silence I've finally got round to releasing these templates. The theme is rather simple: take a standard tuning tool and with a tiny bit of scripting deliver it's output via SNMP for Cacti to graph. This gives you always-on data about the performance of a system and allows unexpected changes to be easily spotted on Cacti graphs. vmstat to SNMPLike I described previously in my SNMP Basics article, I run a cron job to pick up data and dump it in files where snmpd can pick it up as a low privilege user. I'm doing the same here, except that I'm using it to run vmstat in the background to collect data over the polling period. Download: all the iostat Cacti scripts, files and templates are now on GitHub Take the data collection script vmstat-cron, make this executable and stick it somewhere convenient. I will assume /etc/snmp for this article with the output files in /var/local/snmp. Then add to the SNMP cron job (described previously) some lines to run this in the background: # background the vmstat run That will launch vmstat in a wrapper which will run for 5 minutes (300 seconds) outputting to a temporary file and rename the temporary file to the name given as the first argument. You can easily alter the script if you poll more/less frequently. Check that the output file is being created and has data in it - it will take 5 minutes from the next cron run before the file is created. Next, to get the data into snmpd add the following to the /etc/snmp/snmpd.conf file: extend vmstat /bin/cat /var/local/snmp/vmstat That simply picks up the contents of the file when SNMP is queried. Restart snmpd and you should be able to test that with snmpwalk as described in previous articles. SNMP to CactiImport the Cacti template cacti_host_template_vmstat.xml and add it to the host you have configured above. Add the graphs and all going well after a couple polls data should start appearing on the graphs. What it looks like |
|||
This is a bunch of random thoughts, ideas and other nonsense, and is not intended to be taken seriously. I'm experimenting and mostly have no idea what I am doing with most of this so it should be taken with cuation and at your own risk. Intrustive technologies are minimised where possible. For the purposes of reducing abuse and other risks hCaptcha is used and has it's own policies linked from the widget.
Copyright Glen Pitt-Pladdy 2008-2023
|