moved to subdirectory

This commit is contained in:
2024-10-19 16:26:35 +02:00
parent 5489a0d684
commit cfbc8231a6
5 changed files with 0 additions and 0 deletions

99
munin/plugins/433mhz Executable file
View File

@@ -0,0 +1,99 @@
#!/bin/bash
# -*- sh -*-
: << =cut
=head1 NAME
433mhz - Plugin to capture readings from wireless sensors via serial
=head1 NOTES
=head1 AUTHOR
Contributed by Florian Klemenz
=head1 LICENSE
GPLv2
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Wireless temperature sensor readings'
echo 'graph_args --base 1 -l 0 '
echo 'graph_scale no'
echo 'graph_vlabel °C'
echo 'graph_category temperature'
echo 'temp.label Vorratskammer'
echo 'temp.draw LINE'
print_warning temp
print_critical temp
exit 0
fi
# DATA TYPE IDs
#define TYPE_TEMPERATURE 1
#define TYPE_HUMIDITY 2
#define TYPE_VOLTAGE 3
TYPES=( none tmp hmd vlt )
CMD="arduino | tail -n +2"
IFS=$'\n'
SENSORS=( $(eval $CMD) )
#declare -p SENSORS
IFS=' '
for ROW in "${SENSORS[@]}"; do
ENTRY=( $ROW )
NODE=${ENTRY[0]}
SENSOR=${ENTRY[1]}
VALUE=${ENTRY[2]}
TYPE=${ENTRY[3]}
TTL=$(echo "${ENTRY[4]}" | tr -d '[:space:]')
if [ "$TTL" != "0" ] || [ ${ignore_ttl} ]; then
# Overrides NODE - Example: env.node_0 Wohnzimmer
ENV_NODE_VAR_NAME="node_${NODE}"
ENV_NODE_NAME=${!ENV_NODE_VAR_NAME}
# Overrides SENSOR - Example: env.sensor_0_0 Batterie
ENV_SENSOR_VAR_NAME="sensor_${NODE}_${SENSOR}"
ENV_SENSOR_NAME=${!ENV_SENSOR_VAR_NAME}
if [ -n "${ENV_SENSOR_NAME}" ]; then
echo "${ENV_NODE_NAME:-$NODE}_${SENSOR}_${ENV_SENSOR_NAME}.value ${VALUE}"
else
# Overrides TYPE - Example: env.type_1 Batterie
ENV_TYPE_VAR_NAME="type_${TYPE}"
ENV_TYPE_NAME=${!ENV_TYPE_VAR_NAME}
if [ -n "${ENV_TYPE_NAME}" ]; then
echo "${ENV_NODE_NAME:-$NODE}_${SENSOR}_${ENV_TYPE_NAME}.value ${VALUE}"
else
echo "${ENV_NODE_NAME:-$NODE}_${SENSOR}_${TYPES[$TYPE]}.value ${VALUE}"
fi
fi
#echo "${ENV_NODE_NAME:-$NODE}_${ENV_SENSOR_NAME:-$SENSOR}_${TYPES[$TYPE]}.value ${VALUE}"
fi
done
#echo "Vorratskammer.value $TEMP"

70
munin/plugins/ina219 Executable file
View File

@@ -0,0 +1,70 @@
#!/bin/sh
# -*- sh -*-
: << =cut
=head1 NAME
ina219 - Plugin to measure power consumption.
=head1 NOTES
=head1 AUTHOR
Contributed by Florian Klemenz
=head1 LICENSE
GPLv2
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Power'
echo 'graph_args --base 1 -l 0 '
echo 'graph_scale no'
echo 'graph_vlabel mW'
echo 'graph_category power'
echo 'power.label power'
echo 'power.draw LINE'
print_warning power
print_critical power
exit 0
fi
ROUNDS=5
VOLTAGE=0
CURRENT=0
POWER=0
for i in $(seq ${ROUNDS}); do
RESULT=$(/usr/bin/ina219)
VOLTAGE_RAW=$(echo $RESULT | /bin/sed 's/\([0-9]\+\)mV \+\([0-9\.]\+\)mA/\1/')
VOLTAGE=$(echo "scale=3; $VOLTAGE+$VOLTAGE_RAW" | /usr/bin/bc)
CURRENT_RAW=$(echo $RESULT | /bin/sed 's/\([0-9]\+\)mV \+\([0-9\.]\+\)mA/\2/')
CURRENT=$(echo "scale=3; $CURRENT+$CURRENT_RAW" | /usr/bin/bc)
done
VOLTAGE=$(echo "scale=3; $VOLTAGE/$ROUNDS" | /usr/bin/bc)
CURRENT=$(echo "scale=3; $CURRENT/$ROUNDS" | /usr/bin/bc)
POWER=$(echo "scale=3; $VOLTAGE*$CURRENT/1000000" | /usr/bin/bc)
echo "power.value $POWER"