Created
February 13, 2017 15:39
-
-
Save oprietop/eb19a918a1395797939e7d62652d245e to your computer and use it in GitHub Desktop.
Simple collectd Exec plugin example
This file contains 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
# plugin_exec.conf | |
LoadPlugin exec | |
<Plugin exec> | |
Exec "user" "/opt/collectd/etc/metrics/grep_stuff.sh" | |
</Plugin> | |
# grep_stuff.sh | |
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}" | |
INTERVAL="${COLLECTD_INTERVAL:-60}" | |
while sleep "$INTERVAL"; do | |
RES=$(find /logs/file.*.log -mtime -1 -exec grep --line-buffered "StuffToFind" '{}' \; | wc -l) | |
echo "PUTVAL \"$HOSTNAME/grep_log/gauge-stuff\" interval=$INTERVAL N:$RES" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment