mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 18:07:20 +00:00
Initial version
This commit is contained in:
parent
bd6069ae14
commit
8daa48b454
1 changed files with 86 additions and 0 deletions
86
plugins/other/ddclient
Executable file
86
plugins/other/ddclient
Executable file
|
@ -0,0 +1,86 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
# Munin plugin to show changing the ip address by ddclient.
|
||||
# The base frame is copied from the proftp plugin
|
||||
#
|
||||
##########################################################################################
|
||||
# Folgende Eintraege in der Datei /etc/munin/plugin-conf.d/munin-node nicht vergessen ! #
|
||||
# Don't forget to add following lines to the file /etc/munin/plugin-conf.d/munin-node #
|
||||
# [quota] #
|
||||
# user root #
|
||||
##########################################################################################
|
||||
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and installation
|
||||
# scripts):
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
MAXLABEL=20
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title IP Wechsel'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel täglicher IP Wechsel'
|
||||
echo 'graph_category IP'
|
||||
echo 'ip_change.label IP Wechsel'
|
||||
echo 'graph_info Jeder IP-Wechsel der von DDCLIENT festgestellt wird erzeugt einen Wert von 1'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# Beginn des modifizierten Skriptes - Beginning of the modified script #
|
||||
################################################################################
|
||||
|
||||
|
||||
# Nur fuer Testzwecke kann das - For testing only you can
|
||||
# Zeitfenster vergroessert werden resize the reference periode
|
||||
if [ "${1//[^[:digit:]]}" != "" ]; then
|
||||
factor=${1//[^[:digit:]]}
|
||||
else
|
||||
factor=1
|
||||
fi
|
||||
|
||||
# Aktuelle Zeit in Sekunden (C-Format) - now in seconds (c-format)
|
||||
Timestamp=$(date +%s)
|
||||
|
||||
# Zeitfenster in Sekunden - time slot in seconds
|
||||
let Timeslot=60*30*$factor
|
||||
|
||||
# Referenzzeitpunkt berechnen - calculate the reference periode
|
||||
let Ref_Timestamp=Timestamp-Timeslot
|
||||
|
||||
# Zeitstempel der letzten Aktualisierung - timestampe of the last update
|
||||
Last_update=$(grep -i 'last update' /var/cache/ddclient/ddclient.cache)
|
||||
Last_update=${Last_update##*\(}
|
||||
Last_update=${Last_update%%\)}
|
||||
|
||||
# Ausgabe für Munin - output for munin
|
||||
if [ "$Last_update" -gt "$Ref_Timestamp" ]; then
|
||||
echo "ip_change.value 1"
|
||||
else
|
||||
echo "ip_change.value 0"
|
||||
fi
|
||||
|
||||
# Nur zum Testen - for testing ony
|
||||
if [ "$factor" -gt 1 ]; then
|
||||
echo "======================== Nur fuer Testzwecke ======================"
|
||||
echo "Timestamp :" $Timestamp $(date -d "1970-01-01 UTC + $Timestamp seconds")
|
||||
echo "Ref_Timestamp:" $Ref_Timestamp $(date -d "1970-01-01 UTC + $Ref_Timestamp seconds")
|
||||
echo "Zeitfenster :" $((Timeslot/60)) Minuten
|
||||
echo "Last_update :" $Last_update $(date -d "1970-01-01 UTC + $Last_update seconds")
|
||||
echo "======================== for testing only ======================"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue