This commit is contained in:
Michael Grote 2021-09-21 14:41:08 +02:00
parent 727a8e6e82
commit 770071cea5

View file

@ -4,18 +4,56 @@
# Michael Grote
# michael.grote ät posteo.de
# This plugin fetches multiple Values from a mikrotik device.
# tested with a RB750GR3 and CRS309.
# config:
# A User is needed for this plugin to work:
# /user add name=munin group=read password=hallowelt address=<munin-server-ip>
# plugin config:
# [mt_system_<name>]
# user root
# env.ssh_user munin
# env.ssh_password hallowelt
# env.ssh_host 192.168.2.1
# env.name hex
# on the router
# /user add name=munin group=read password=hallowelt address=<munin-server-ip>
# TODO:
# - [ ] normal cpu mit rein
# - [ ] limits für cpu
# - [ ] alles als func
# - [ ] doku
# - [ ] free-hdd-space: 4760.0KiB
# - [ ] total-hdd-space: 16.3MiB
# - [ ] free-memory: 210.2MiB
# - [ ] total-memory: 256.0MiB
# - [ ] uptime: 1w4d22h29m28s
# setze Variablen mit default-Werten
ssh_user=${ssh_user:-user}
ssh_password=${ssh_password:-password}
ssh_host=${ssh_host:-192.168.2.1}
c=0 # zähler; wird für verschiedene Schleifen benötigt
# hole daten per ssh
data=$(sshpass -p $ssh_password ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $ssh_user@$ssh_host -q ':delay 6s; /system health print; /system resource print; /system resource cpu print; /system identity print')
# munin-Logik
# wenn $1 = X; dann
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
exit 0
fi
exit 0
# Beispieloutput:
# voltage: 24.5V
# temperature: 46C
# uptime: 1w6d17h12m25s
@ -41,27 +79,4 @@
# 1 cpu1 1% 1% 0%
# 2 cpu2 0% 0% 0%
# 3 cpu3 1% 0% 0%
#free-hdd-space: 4760.0KiB
#total-hdd-space: 16.3MiB
#free-memory: 210.2MiB
#total-memory: 256.0MiB
#uptime: 1w4d22h29m28s
# echo $line | awk '/bad-blocks:/{
# print "multigraph bad_blocks_graph_""'"$name"'";
# print "graph_title Total sector writes " "'"$name"'";
# print "graph_vlabel %";
# print "graph_category mikrotik";
# print "graph_args -l 0 --upper-limit 100";
# print "bad_blocks.label bad_blocks";
# print "bad_blocks.warning 2";
# print "bad_blocks.critical 25";
# gsub(/%/,"",$2);
# print "bad_blocks.value " $2
# }'
# IN DOKU mit erklärung
#normal cpu mit rein
#limits für cpu
# name: hEX