From 1c0440a798a2e9964ee1f18c9a382c9457194259 Mon Sep 17 00:00:00 2001 From: Robert Kilian Date: Thu, 9 Aug 2012 15:26:21 -0700 Subject: [PATCH] Initial commit of Xastir plugin --- plugins/xastir/README | 5 ++ plugins/xastir/xastir | 111 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 plugins/xastir/README create mode 100755 plugins/xastir/xastir diff --git a/plugins/xastir/README b/plugins/xastir/README new file mode 100644 index 00000000..720841ae --- /dev/null +++ b/plugins/xastir/README @@ -0,0 +1,5 @@ +Be sure to correctly edit the STATION_CALL, XASTIRDIR, and LOGDIR variables + +STATION_CALL: The callsign used by Xastir (include suffix if one is in use) +XASTIRDIR: The directory where Xastir's data, config, etc files are found. Typically ~/.xastir +LOGDIR: Logs are typically stored in ~/.xastir/logs. Ensure that permissions are set appropriately to allow the munin user to read these logs diff --git a/plugins/xastir/xastir b/plugins/xastir/xastir new file mode 100755 index 00000000..ffe082fa --- /dev/null +++ b/plugins/xastir/xastir @@ -0,0 +1,111 @@ +#!/bin/bash + +## Copyright (C) 2012 Robert Kilian +## +## This file is part of the Xastir plugin for Munin. +## +## Xastir-Munin is free software; you can redistribute it and/or +## modify it under the terms of the GNU General Public +## License as published by the Free Software Foundation; +## either version 3 of the License, or (at your option) any +## later version. +## +## Xastir-Munin is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied +## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +## PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public +## License along with Xastir-Munin; see the file COPYING. If not, +## see . +## +## Version 0.1 -- 07.26.12 +## + +# Location of active instance of Xastir +XASTIRDIR="/home/USERNAME/.xastir" + +# Grab the station's callsign from Xastir config +# this currently does not derive the station call correctly when called by the server, but works using munin-run... +#STATION_CALL=`grep ^STATION_CALLSIGN:.* $XASTIRDIR/config/xastir.cnf | awk -F":" '{print $2}'` +STATION_CALL="" + +# Location of Xastir's logs (this can be a symlink to where Xastir actually writes the logs) +LOGDIR="/var/log/xastir/logs" + + +case $1 in + config) + cat <<'EOM' + +graph_title Xastir Packet Stats +graph_vlabel Packets +graph_category ham_radio +graph_scale no +graph_printf %.0lf + +igatetonet.label IGate - RF to Net +igatetonet.type COUNTER +igatetonet.min 0 +igatetonet.max 500 +igatetonet.LINE1 + +message.label Message RX +message.type COUNTER +message.min 0 +message.max 500 +message.draw LINE1 + +messagetx.label Message TX +messagetx.type COUNTER +messagetx.min 0 +messagetx.max 500 +messagetx.draw LINE1 + +net.label Net RX +net.type COUNTER +net.min 0 +net.max 500 +net.draw LINE1 + +nettx.label Net TX +nettx.type COUNTER +nettx.min 0 +nettx.max 500 +nettx.draw LINE1 + +tnc.label TNC RX +tnc.type COUNTER +tnc.min 0 +tnc.max 500 +tnc.draw LINE1 + +tnctx.label TNC TX +tnctx.type COUNTER +tnctx.min 0 +tnctx.max 500 +tnctx.draw LINE1 + +EOM + exit 0;; +esac + +# Parse logs for various values +IGATETONET=`cat $LOGDIR/igate.log | grep -e '^IGATE RF' | wc -l` +MESSAGE=`cat $LOGDIR/message.log | grep -v '^\#' | grep -v ^$STATION_CALL | wc -l` +MESSAGETX=`cat $LOGDIR/message.log | grep -v '^\#' | grep ^$STATION_CALL | wc -l` +NET=`cat $LOGDIR/net.log | grep -v '^\#' | grep -v ^$STATION_CALL | wc -l` +NETTX=`cat $LOGDIR/net.log | grep -v '^\#' | grep ^$STATION_CALL | wc -l` +TNC=`cat $LOGDIR/tnc.log | grep -v '^\#' | grep -v ^$STATION_CALL | wc -l` +TNCTX=`cat $LOGDIR/tnc.log | grep -v '^\#' | grep ^$STATION_CALL | wc -l` + +# Display values +echo "igatetonet.value $IGATETONET" +echo "message.value $MESSAGE" +echo "messagetx.value $MESSAGETX" +echo "net.value $NET" +echo "nettx.value $NETTX" +echo "tnc.value $TNC" +echo "tnctx.value $TNCTX" +