139 lines
4.6 KiB
XML
139 lines
4.6 KiB
XML
<?xml version='1.0' standalone='yes'?>
|
|
<!DOCTYPE PLUGIN [
|
|
<!ENTITY name "prometheus_pihole_exporter">
|
|
<!ENTITY author "ich777">
|
|
<!ENTITY version "2025.03.26">
|
|
<!ENTITY launch "Settings/pihole_exporter">
|
|
<!ENTITY gitURL "https://github.com/&author;/unraid-&name;/raw/master">
|
|
<!ENTITY pluginURL "&gitURL;/&name;.plg">
|
|
<!ENTITY md5 "44e4ca0e9de1b749f2fe91b4d979a620">
|
|
<!ENTITY plugin "/boot/config/plugins/&name;">
|
|
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
|
|
]>
|
|
|
|
<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" min="6.9.0" support="https://forums.unraid.net/topic/110995-plugin-prometheus-unraid-plugins/">
|
|
|
|
<CHANGES>
|
|
|
|
###2025.03.26
|
|
- Compatibility update for PiHole Exporter v1.0.1, please note from now on this plugin will only work with PiHole v6+
|
|
|
|
###2025.03.06
|
|
- Bumped version - based on PiHole Exporter v1.0.1
|
|
|
|
###2022.02.25
|
|
- Fixed startup issue, thanks to Github user maniac-semal for the report
|
|
|
|
###2022.02.20
|
|
- Bumped version - based on PiHole Exporter v0.3.0
|
|
|
|
###2022.02.11
|
|
- Bumped version - based on PiHole Exporter v0.2.0
|
|
|
|
###2021.12.27
|
|
- Bumped version - based on PiHole Exporter v0.1.1
|
|
|
|
###2021.12.22
|
|
- Bumped version - based on PiHole Exporter v0.1.0
|
|
|
|
###2021.09.17
|
|
- Fixed plugin to escape variables properly
|
|
|
|
###2021.07.09
|
|
- Fixed non working 'Start' button on plugin page
|
|
|
|
###2021.07.05
|
|
- Made port form PiHole WebUI changeable on plugin page
|
|
|
|
###2021.06.30
|
|
- Fixed buttons not showing up on plugin page in Chrome based browsers - thanks to S3ppo
|
|
|
|
###2021.06.28
|
|
- Initial release - based on version v0.0.11
|
|
|
|
</CHANGES>
|
|
|
|
<FILE Run="/bin/bash">
|
|
<INLINE>
|
|
rm -f $(ls /boot/config/plugins/&name;/&name;*.tgz 2>/dev/null|grep -v '&version;')
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Name="/boot/config/plugins/&name;/&name;-&version;.tgz" Run="upgradepkg --install-new">
|
|
<URL>&gitURL;/packages/&name;-&version;.tgz</URL>
|
|
<MD5>&md5;</MD5>
|
|
</FILE>
|
|
|
|
<FILE Name="&emhttp;/README.md">
|
|
<INLINE>
|
|
**Prometheus Pi-Hole Exporter**
|
|
|
|
Is a slim plugin, that takes informations gathered from the Pi-Hole API and provides it to a Prometheus database. Usage is not limited to Prometheus only. Data can be formated and displayed to any database or graphical node.
|
|
Export URL: The URL for the exportet metrics is: 'http://YOURunRAIDIP:9617/metrics' (to use it in Prometheus add the target: 'YOURunRAIDIP:9617' to your Prometheus yaml).
|
|
This Plugin is based on pihole-exporter from eko: https://github.com/eko/pihole-exporter
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Run="/bin/bash">
|
|
<INLINE>
|
|
|
|
#Create settings file if not found
|
|
if [ ! -f "&plugin;/settings.cfg" ]; then
|
|
echo 'pihole_hostname=
|
|
pihole_password=
|
|
pihole_protocol=http
|
|
pihole_port=80
|
|
exporter_interval=10
|
|
exporter_port=9617' > "&plugin;/settings.cfg"
|
|
else
|
|
sed -i '/^pihole_api_token=/d' "&plugin;/settings.cfg"
|
|
if ! grep -q "pihole_password=" &plugin;/settings.cfg; then
|
|
sed -i '$ a\pihole_password=' &plugin;/settings.cfg
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$(pidof prometheus_pihole_exporter)" ]; then
|
|
PIH_HOST="$(cat &plugin;/settings.cfg | grep "pihole_hostname=" | cut -d '=' -f2-)"
|
|
if [ ! -z "${PIH_HOST}" ]; then
|
|
PIH_PWD="$(cat &plugin;/settings.cfg | grep "pihole_password=" | cut -d '=' -f2-)"
|
|
PIH_PROTO="$(cat &plugin;/settings.cfg | grep "pihole_protocol=" | cut -d '=' -f2-)"
|
|
PIH_PORT="$(cat &plugin;/settings.cfg | grep "pihole_port=" | cut -d '=' -f2-)"
|
|
EXP_INTERV="$(cat &plugin;/settings.cfg | grep "exporter_interval=" | cut -d '=' -f2-)"
|
|
EXP_PORT="$(cat &plugin;/settings.cfg | grep "exporter_port=" | cut -d '=' -f2-)"
|
|
#Starting Prometheus Pi-Hole Exporter Daemon
|
|
echo
|
|
echo "-------------Starting Prometheus Pi-Hole Exporter!--------------"
|
|
echo "&emhttp;/include/prometheus_pihole_exporter_init.sh $PIH_HOST $PIH_PROTO $PIH_PORT $EXP_PORT $EXP_INTERV $PIH_PWD" | at now -M
|
|
else
|
|
echo "---Please enter your connection details for PiHole on the plugin configuration page!---"
|
|
fi
|
|
else
|
|
echo
|
|
echo "---Nothing to do, Prometheus Pi-Hole Exporter already started---"
|
|
fi
|
|
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Run="/bin/bash" Method="remove">
|
|
<INLINE>
|
|
|
|
echo "---------------------------------------------"
|
|
echo "---Uninstalling prometheus_pihole_exporter---"
|
|
echo "---------------------------------------------"
|
|
# Remove plugin related files
|
|
kill $(pidof prometheus_pihole_exporter) 2>/dev/null
|
|
removepkg &name;-&version;
|
|
rm -rf /usr/local/emhttp/plugins/&name;
|
|
rm -rf &plugin;
|
|
echo
|
|
echo "------------------------------------------------------------"
|
|
echo "---Uninstallation of prometheus_pihole_exporter complete!---"
|
|
echo "------------------------------------------------------------"
|
|
echo
|
|
|
|
</INLINE>
|
|
</FILE>
|
|
</PLUGIN> |