collectd - improvements/additions
* enable unix socket for nagios monitoring * Add data collection for unbound
This commit is contained in:
parent
ef4934efb7
commit
a90f8076d8
|
@ -0,0 +1,7 @@
|
||||||
|
# unbound-collectd.sh
|
||||||
|
Simple script to monitor unbound
|
||||||
|
|
||||||
|
# Prerequisites
|
||||||
|
* Unbound
|
||||||
|
* `/etc/unbound/*.key` and `/etc/unbound/*.pem` should have group unbound
|
||||||
|
* exec section should execute the script with user unbound
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# simple script to monitor unbound
|
||||||
|
# All metrics are gauges
|
||||||
|
|
||||||
|
HOSTNAME="${COLLECTD_HOSTNAME:-eric}"
|
||||||
|
INTERVAL="${COLLECTD_INTERVAL:-10}"
|
||||||
|
|
||||||
|
while sleep "$INTERVAL"; do
|
||||||
|
/usr/sbin/unbound-control stats | while read line;do
|
||||||
|
INSTANCE=`echo $line | cut -d= -f1 | cut -d. -f1`
|
||||||
|
STAT=`echo $line | cut -d= -f1 | cut -d. -f2- \
|
||||||
|
| sed 's/\./-/g' | sed 's/recursion-time-/recursion-time_/g' \
|
||||||
|
| sed 's/now/time-now/g' | sed 's/up/time-up/g' \
|
||||||
|
| sed 's/elapsed/time-elapsed/g' `
|
||||||
|
VALUE=`echo $line | cut -d= -f2`
|
||||||
|
|
||||||
|
echo "PUTVAL \"$HOSTNAME/unbound-${INSTANCE}/$STAT\" interval=$INTERVAL N:$VALUE"
|
||||||
|
done
|
||||||
|
done
|
|
@ -223,6 +223,20 @@ LoadPlugin snmp
|
||||||
</Host>
|
</Host>
|
||||||
</Plugin>
|
</Plugin>
|
||||||
|
|
||||||
|
# monitor unbound by exec
|
||||||
|
LoadPlugin exec
|
||||||
|
<Plugin exec>
|
||||||
|
Exec "unbound" "/usr/local/bin/unbound-collectd.sh"
|
||||||
|
</Plugin>
|
||||||
|
|
||||||
|
# See collectd.conf(5)
|
||||||
|
LoadPlugin unixsock
|
||||||
|
<Plugin unixsock>
|
||||||
|
SocketFile "/tmp/collectd.sock"
|
||||||
|
SocketGroup "nagios"
|
||||||
|
SocketPerms "0770"
|
||||||
|
</Plugin>
|
||||||
|
|
||||||
# and finaly save the data in graphite
|
# and finaly save the data in graphite
|
||||||
LoadPlugin write_graphite
|
LoadPlugin write_graphite
|
||||||
<Plugin write_graphite>
|
<Plugin write_graphite>
|
||||||
|
|
Loading…
Reference in New Issue