Created
April 8, 2011 18:43
-
-
Save noahcampbell/910461 to your computer and use it in GitHub Desktop.
Collect meminfo information for collectd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadPlugin exec | |
<Plugin exec> | |
Exec deploy "/var/lib/rundeck/monitoring/meminfo.sh" | |
</Plugin> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See http://lwn.net/Articles/28345/ for an explanation of the values below. | |
MemTotal: 15736360 kB | |
MemFree: 2665220 kB | |
Buffers: 235836 kB | |
Cached: 2573220 kB | |
SwapCached: 0 kB | |
Active: 11961200 kB | |
Inactive: 589692 kB | |
SwapTotal: 0 kB | |
SwapFree: 0 kB | |
Dirty: 10776 kB | |
Writeback: 0 kB | |
AnonPages: 9741516 kB | |
Mapped: 38488 kB | |
Slab: 161716 kB | |
SReclaimable: 121780 kB | |
SUnreclaim: 39936 kB | |
PageTables: 27844 kB | |
NFS_Unstable: 0 kB | |
Bounce: 0 kB | |
CommitLimit: 7868180 kB | |
Committed_AS: 10674176 kB | |
VmallocTotal: 34359738367 kB | |
VmallocUsed: 180 kB | |
VmallocChunk: 34359738187 kB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat /var/lib/rundeck/monitoring/meminfo.sh | |
#!/bin/bash | |
HOSTNAME="${HOSTNAME:-`hostname -f`}" | |
INTERVAL="${COLLECTD_INTERVAL:-10}" | |
while sleep "$INTERVAL" | |
do | |
#Getting output. | |
start_run=$(date +%s) | |
${start_run}:\2/p" | tee /tmp/watchoutput | |
cat /proc/meminfo | sed -r -n "s/(.*):[ ]*(.+) kB/\1 \2/p" | awk -v hn=$HOSTNAME -v interval=$INTERVAL '/.*/ { printf("PUTVAL %s/meminfo/memory-%s interval=%s N:%s\n", hn, $1, interval, ($2 * 1024)) }' | tee /tmp/watchoutput | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment