Skip to content

Instantly share code, notes, and snippets.

@hackaugusto
Created November 30, 2012 14:21
Show Gist options
  • Select an option

  • Save hackaugusto/4176060 to your computer and use it in GitHub Desktop.

Select an option

Save hackaugusto/4176060 to your computer and use it in GitHub Desktop.
cacti - data query
#!/bin/sh
sed -e "s/\[.*\]\([^:]*\)\(.*\)/\1/" /var/log/httpd/error_log |
sort |
uniq -c |
tr -s " " |
sed 's/^[ ]//g' |
cut -f 1 -d ' ' |
awk '{a+=$0}END{print a}'
IF-MIB::ifInOctets.1 = Counter32: 331453802
IF-MIB::ifInOctets.2 = Counter32: 5572307
IF-MIB::ifOutOctets.1 = Counter32: 4113764072
IF-MIB::ifOutOctets.2 = Counter32: 1670066329
<ifInOctets>
<name>Bytes In</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.2.1.2.2.1.10</oid>
</ifInOctets>
<ifOutOctets>
<name>Bytes Out</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.2.1.2.2.1.16</oid>
</ifOutOctets>
extend .1.3.6.1.3.1 APACHEERR /usr/share/webapps/cacti/scripts/apacheerr.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment