Created
July 25, 2012 20:46
-
-
Save jippi/3178577 to your computer and use it in GitHub Desktop.
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 "nobody:nogroup" "/etc/collectd/redis.sh" | |
| </Plugin> | |
| # -> ll redis.sh | |
| # 4 -rwxr-xr-x 1 nobody nogroup 790 Jul 25 22:44 redis.sh |
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
| #!/bin/bash | |
| HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}" | |
| INTERVAL="${COLLECTD_INTERVAL:-10}" | |
| #while sleep "$INTERVAL" | |
| #do | |
| info=$(redis-cli info) | |
| for key in connected_clients connected_slaves uptime_in_seconds used_memory changes_since_last_save total_commands_processed keyspace_misses keyspace_hits pubsub_patterns pubsub_channels evicted_keys expired_keys total_connections_received used_cpu_sys used_cpu_user used_cpu_sys_children used_cpu_user_children | |
| do | |
| value=$(echo "$info" | awk -F : "\$1 == \"$key\" {print \$2}") | |
| echo "PUTVAL \"$HOSTNAME/redis/$key\" interval=$INTERVAL N:$value" | |
| done | |
| keys=$(echo "$info"|egrep -e "^db0"|sed -e 's/^.\+:keys=//'|sed -e 's/,.\+//') | |
| echo "PUTVAL \"$HOSTNAME/redis/db0/keys\" interval=$INTERVAL N:$keys" | |
| #done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment