pihole hinzugefügt

This commit is contained in:
Michael Grote 2021-09-16 14:31:48 +02:00
parent 6e4a0392a3
commit 1593e83a7a
3 changed files with 134 additions and 0 deletions

45
extern/pihole/pihole_cache vendored Normal file
View file

@ -0,0 +1,45 @@
#!/bin/sh
# Sample setup for '/etc/munin/plugin-conf.d/munin-node':
#
# [pihole_*]
# user root
# env.host 127.0.0.1
# env.port 80
# env.api /admin/api.php
envhost=${host:-127.0.0.1}
envport=${port:-80}
envapi=${api:-/admin/api.php}
apicall=$(curl -s "$envhost:$envport$envapi" 2>/dev/null)
stats=$(echo $apicall | sed 's/[{}"]//g' | tr "," "\n")
case $1 in
config)
echo "graph_title Pihole Queries Cache"
echo "graph_vlabel queries rate"
echo "graph_category pihole"
echo "graph_info This graph shows the Pihole queries cache statistics."
for stat in $stats
do
uid=$(echo $stat | sed 's/:.*//')
if [ $uid = "queries_forwarded" ] || [ $uid = "queries_cached" ]; then
echo "$uid.label $uid"
echo "$uid.type DERIVE"
echo "$uid.min 0"
fi
done
exit 0;;
esac
for stat in $stats
do
uid=$(echo $stat | sed 's/:.*//')
if [ $uid = "queries_forwarded" ] || [ $uid = "queries_cached" ]; then
value=$(echo $stat | sed 's/.*://')
echo "$uid.value $value"
fi
done

44
extern/pihole/pihole_clients vendored Normal file
View file

@ -0,0 +1,44 @@
#!/bin/sh
# Sample setup for '/etc/munin/plugin-conf.d/munin-node':
#
# [pihole_*]
# user root
# env.host 127.0.0.1
# env.port 80
# env.api /admin/api.php
envhost=${host:-127.0.0.1}
envport=${port:-80}
envapi=${api:-/admin/api.php}
apicall=$(curl -s "$envhost:$envport$envapi" 2>/dev/null)
stats=$(echo $apicall | sed 's/[{}"]//g' | tr "," "\n")
case $1 in
config)
echo "graph_title Pihole Clients"
echo "graph_vlabel count"
echo "graph_category pihole"
echo "graph_info This graph shows the Pihole unique clients statistics."
for stat in $stats
do
uid=$(echo $stat | sed 's/:.*//')
if [ $uid = "unique_clients" ]; then
echo "$uid.label $uid"
echo "$uid.min 0"
fi
done
exit 0;;
esac
for stat in $stats
do
uid=$(echo $stat | sed 's/:.*//')
if [ $uid = "unique_clients" ]; then
value=$(echo $stat | sed 's/.*://')
echo "$uid.value $value"
fi
done

45
extern/pihole/pihole_queries vendored Normal file
View file

@ -0,0 +1,45 @@
#!/bin/sh
# Sample setup for '/etc/munin/plugin-conf.d/munin-node':
#
# [pihole_*]
# user root
# env.host 127.0.0.1
# env.port 80
# env.api /admin/api.php
envhost=${host:-127.0.0.1}
envport=${port:-80}
envapi=${api:-/admin/api.php}
apicall=$(curl -s "$envhost:$envport$envapi" 2>/dev/null)
stats=$(echo $apicall | sed 's/[{}"]//g' | tr "," "\n")
case $1 in
config)
echo "graph_title Pihole Queries"
echo "graph_vlabel queries rate"
echo "graph_category pihole"
echo "graph_info This graph shows the Pihole queries statistics."
for stat in $stats
do
uid=$(echo $stat | sed 's/:.*//')
if [ $uid = "dns_queries_today" ] || [ $uid = "ads_blocked_today" ]; then
echo "$uid.label $(echo $uid | sed 's/_today//')"
echo "$uid.type DERIVE"
echo "$uid.min 0"
fi
done
exit 0;;
esac
for stat in $stats
do
uid=$(echo $stat | sed 's/:.*//')
if [ $uid = "dns_queries_today" ] || [ $uid = "ads_blocked_today" ]; then
value=$(echo $stat | sed 's/.*://')
echo "$uid.value $value"
fi
done