munin-plugins/mikrotik/mt_system

83 lines
1.9 KiB
Text
Raw Normal View History

#!/bin/bash
#%# family=auto
#%# capabilities=autoconf
# Michael Grote
# michael.grote ät posteo.de
2021-09-21 14:41:08 +02:00
# This plugin fetches multiple Values from a mikrotik device.
# tested with a RB750GR3 and CRS309.
2021-09-21 14:41:08 +02:00
# 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
2021-09-21 14:41:08 +02:00
# 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')
2021-09-21 14:41:08 +02:00
# 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:
2021-09-21 14:09:15 +02:00
# voltage: 24.5V
# temperature: 46C
# uptime: 1w6d17h12m25s
# version: 6.48.4 (stable)
# build-time: Aug/18/2021 06:43:27
# factory-software: 6.46.3
# free-memory: 209.9MiB
# total-memory: 256.0MiB
# cpu: MIPS 1004Kc V2.15
# cpu-count: 4
# cpu-frequency: 880MHz
# cpu-load: 0%
# free-hdd-space: 4760.0KiB
# total-hdd-space: 16.3MiB
# write-sect-since-reboot: 46412
# write-sect-total: 62012
# bad-blocks: 0%
# architecture-name: mmips
# board-name: hEX
# platform: MikroTik
# # CPU LOAD IRQ DISK
# 0 cpu0 0% 0% 0%
# 1 cpu1 1% 1% 0%
# 2 cpu2 0% 0% 0%
# 3 cpu3 1% 0% 0%
2021-09-21 14:41:08 +02:00
# name: hEX