]> ###2023.02.26 - Bugfix in plugin file - thank you glennbrown from the Forums ###2023.01.18 - Added more metrics for NVME devices - thank you strayer from the Forums ###2021.07.05 - Updated package ###2021.07.04 - Initial release rm -f $(ls /boot/config/plugins/&name;/&name;*.txz 2>/dev/null|grep -v '&version;') &gitURL;/packages/&name;-&version;.txz &md5; **Prometheus smartctl Exporter** Is a slim plugin, that takes informations gathered form your unRAID disks via smartctl and provides it to a Prometheus database via the Prometheus Node Exporter plugin. ATTENTION: This plugin needs the Prometheus Node Exporter plugin installed to work properly and will provide the data from your disks through it. This Plugin is based on: https://github.com/micha37-martins/S.M.A.R.T-disk-monitoring-for-Prometheus # Check if Prometheus Node Exporter is installed, if not cancle installation if [ ! -d /boot/config/plugins/prometheus_node_exporter ]; then echo "---Prometheus Node Exporter not found, aborting installation!---" removepkg &name;-&version; exit 1 else echo "---Prometheus Node Exporter found, continuing!---" fi # Create settings file if not found if [ ! -f "&plugin;/settings.cfg" ]; then echo 'interval=2m' > "&plugin;/settings.cfg" fi # Create temporary directory for export if [ ! -d "/tmp/prom_export" ]; then mkdir -p /tmp/prom_export fi # Check if settings file for Prometheus Node Export is already patched NODE_SETTINGS="$(cat /boot/config/plugins/prometheus_node_exporter/settings.cfg | cut -d '=' -f2-)" if [[ ! $(echo ${NODE_SETTINGS} | grep "collector.textfile.director") ]]; then if [ -z ${NODE_SETTINGS} ]; then sed -i 's/start_parameters=/start_parameters=--collector.textfile.directory=\/tmp\/prom_export/g' /boot/config/plugins/prometheus_node_exporter/settings.cfg else sed -i 's/$/ \-\-collector.textfile.directory=\/tmp\/prom_export/' /boot/config/plugins/prometheus_node_exporter/settings.cfg fi kill $(pidof prometheus_node_exporter) 2>/dev/null sleep 1 echo "/usr/bin/prometheus_node_exporter $(cat /boot/config/plugins/prometheus_node_exporter/settings.cfg | cut -d '=' -f2-)" | at now fi # Start Exporter if [ ! -z "$(ps -fu root | grep "smartctl_exporter.sh" | grep -v "grep" | awk '{print $2}')" ]; then echo "---Prometheus smartctl Exporter already started!---" else echo "---Starting Prometheus smartctl Exporter---" INTERVAL="$(cat "&plugin;/settings.cfg" | cut -d '=' -f2-)" echo "&emhttp;/smartctl_exporter.sh ${INTERVAL} 2>/dev/null" | at now fi echo "-----------------------------------------------" echo "---Uninstalling prometheus_smartctl_exporter---" echo "-----------------------------------------------" # Remove plugin related files kill $(ps -fu root | grep "smartctl_exporter.sh" | grep -v "grep" | awk '{print $2}') sed -i 's/--collector.textfile.directory=\/tmp\/prom_export//g' /boot/config/plugins/prometheus_node_exporter/settings.cfg removepkg &name;-&version; rm -rf /usr/local/emhttp/plugins/&name; rm -rf &plugin; echo echo "--------------------------------------------------------------" echo "---Uninstallation of prometheus_smartctl_exporter complete!---" echo "--------------------------------------------------------------" echo