Add CheckMK plugins

Document the currently used monitoring plugins (ref. #12)
Add the patched QEMU plugin
This commit is contained in:
Albert Stefanov 2023-10-15 09:32:29 +03:00
parent 2dcf3c4753
commit e193edb501
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# CheckMK Plugins
Monitoring plugins for Openfest 2023
## Installation
Built-in plugins are downloaded directly from the monitoring site ([Internal URL](http://monitoring.openfest.org/)).
Custom plugins are downloaded from this repo.
The files are installed to `/usr/lib/check_mk_agent/plugins` with execute permissions (ex. `755`).
## Plugin List
| Name | Type | Installed on | Notes |
| ------------ | ----------------------------------------------- | ------------ | ---------------------------- |
| qemu | [Custom](https://exchange.checkmk.com/p/qemu-1) | sonata | Patched to work on debian 12 |
| smart | Built-in | sonata | Disk SMART monitoring |
| isc_dhcpd.py | Built-in | dns | DHCP pool usage |

37
tools/cmk-plugins/qemu Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# based upon 'qemu' from
# 12/2010 Matthias Henze
# Lizenz: GPL v2
#
# updated for libvirtd (virsh) by
# Jonathan Mills 09/2011
#
# updated by
# Christian Burmeister 05/2015
#
# updated formating:
# Bastian Kuhn 08/2018
#
# Update PID regexp:
# Albert Stefanov 10/2023
if which virsh >/dev/null; then
echo '<<<qemu>>>'
virsh list | grep -v 'State' | grep -v '^--' | grep -v '^$' | while read L
do
ID=$(echo $L | awk '{print $1}')
NAME=$(echo $L | awk '{print $2}')
STATE=$(echo $L | awk '{print $3}')
MEM=$(virsh dominfo $NAME | grep 'Used memory' | awk '{print $3}')
let MEM=MEM/1024
PID=$(pgrep -f -- "/qemu-system-x86_64 .*-name guest=$NAME")
if [ -n "$PID" ]; then
DATA=$(top -p $PID -n 1 -b | sed '${/^$/d}' | tail -1 | awk -- '{print $9" "$10}')
else
DATA=""
fi
echo $ID" "$NAME" "$STATE" "$MEM" "$DATA
done
fi