root / plugins / xastir / xastir @ 17f78427
Historique | Voir | Annoter | Télécharger (3,24 ko)
| 1 |
#!/bin/bash |
|---|---|
| 2 |
|
| 3 |
## Copyright (C) 2012 Robert Kilian <robertkilian@ostechnologies.net> |
| 4 |
## |
| 5 |
## This file is part of the Xastir plugin for Munin. |
| 6 |
## |
| 7 |
## Xastir-Munin is free software; you can redistribute it and/or |
| 8 |
## modify it under the terms of the GNU General Public |
| 9 |
## License as published by the Free Software Foundation; |
| 10 |
## either version 3 of the License, or (at your option) any |
| 11 |
## later version. |
| 12 |
## |
| 13 |
## Xastir-Munin is distributed in the hope that it will be useful, |
| 14 |
## but WITHOUT ANY WARRANTY; without even the implied |
| 15 |
## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 16 |
## PURPOSE. See the GNU General Public License for more |
| 17 |
## details. |
| 18 |
## |
| 19 |
## You should have received a copy of the GNU General Public |
| 20 |
## License along with Xastir-Munin; see the file COPYING. If not, |
| 21 |
## see <http://www.gnu.org/licenses/>. |
| 22 |
## |
| 23 |
## Version 0.1 -- 07.26.12 |
| 24 |
## |
| 25 |
|
| 26 |
## Be sure to correctly edit the STATION_CALL, XASTIRDIR, and LOGDIR variables |
| 27 |
## |
| 28 |
## STATION_CALL: The callsign used by Xastir (include suffix if one is in use) |
| 29 |
## XASTIRDIR: The directory where Xastir's data, config, etc files are found. Typically ~/.xastir |
| 30 |
## LOGDIR: Logs are typically stored in ~/.xastir/logs. Ensure that permissions are set appropriately to allow the munin user to read these logs |
| 31 |
|
| 32 |
# Location of active instance of Xastir |
| 33 |
XASTIRDIR="/home/USERNAME/.xastir" |
| 34 |
|
| 35 |
# Grab the station's callsign from Xastir config |
| 36 |
# this currently does not derive the station call correctly when called by the server, but works using munin-run... |
| 37 |
#STATION_CALL=`grep ^STATION_CALLSIGN:.* $XASTIRDIR/config/xastir.cnf | awk -F":" '{print $2}'`
|
| 38 |
STATION_CALL="" |
| 39 |
|
| 40 |
# Location of Xastir's logs (this can be a symlink to where Xastir actually writes the logs) |
| 41 |
LOGDIR="/var/log/xastir/logs" |
| 42 |
|
| 43 |
|
| 44 |
case $1 in |
| 45 |
config) |
| 46 |
cat <<'EOM' |
| 47 |
|
| 48 |
graph_title Xastir Packet Stats |
| 49 |
graph_vlabel Packets |
| 50 |
graph_category radio |
| 51 |
graph_scale no |
| 52 |
graph_printf %.0lf |
| 53 |
|
| 54 |
igatetonet.label IGate - RF to Net |
| 55 |
igatetonet.type COUNTER |
| 56 |
igatetonet.min 0 |
| 57 |
igatetonet.max 500 |
| 58 |
igatetonet.LINE1 |
| 59 |
|
| 60 |
message.label Message RX |
| 61 |
message.type COUNTER |
| 62 |
message.min 0 |
| 63 |
message.max 500 |
| 64 |
message.draw LINE1 |
| 65 |
|
| 66 |
messagetx.label Message TX |
| 67 |
messagetx.type COUNTER |
| 68 |
messagetx.min 0 |
| 69 |
messagetx.max 500 |
| 70 |
messagetx.draw LINE1 |
| 71 |
|
| 72 |
net.label Net RX |
| 73 |
net.type COUNTER |
| 74 |
net.min 0 |
| 75 |
net.max 500 |
| 76 |
net.draw LINE1 |
| 77 |
|
| 78 |
nettx.label Net TX |
| 79 |
nettx.type COUNTER |
| 80 |
nettx.min 0 |
| 81 |
nettx.max 500 |
| 82 |
nettx.draw LINE1 |
| 83 |
|
| 84 |
tnc.label TNC RX |
| 85 |
tnc.type COUNTER |
| 86 |
tnc.min 0 |
| 87 |
tnc.max 500 |
| 88 |
tnc.draw LINE1 |
| 89 |
|
| 90 |
tnctx.label TNC TX |
| 91 |
tnctx.type COUNTER |
| 92 |
tnctx.min 0 |
| 93 |
tnctx.max 500 |
| 94 |
tnctx.draw LINE1 |
| 95 |
|
| 96 |
EOM |
| 97 |
exit 0;; |
| 98 |
esac |
| 99 |
|
| 100 |
# Parse logs for various values |
| 101 |
IGATETONET=`cat $LOGDIR/igate.log | grep -e '^IGATE RF' | wc -l` |
| 102 |
MESSAGE=`cat $LOGDIR/message.log | grep -v '^\#' | grep -v ^$STATION_CALL | wc -l` |
| 103 |
MESSAGETX=`cat $LOGDIR/message.log | grep -v '^\#' | grep ^$STATION_CALL | wc -l` |
| 104 |
NET=`cat $LOGDIR/net.log | grep -v '^\#' | grep -v ^$STATION_CALL | wc -l` |
| 105 |
NETTX=`cat $LOGDIR/net.log | grep -v '^\#' | grep ^$STATION_CALL | wc -l` |
| 106 |
TNC=`cat $LOGDIR/tnc.log | grep -v '^\#' | grep -v ^$STATION_CALL | wc -l` |
| 107 |
TNCTX=`cat $LOGDIR/tnc.log | grep -v '^\#' | grep ^$STATION_CALL | wc -l` |
| 108 |
|
| 109 |
# Display values |
| 110 |
echo "igatetonet.value $IGATETONET" |
| 111 |
echo "message.value $MESSAGE" |
| 112 |
echo "messagetx.value $MESSAGETX" |
| 113 |
echo "net.value $NET" |
| 114 |
echo "nettx.value $NETTX" |
| 115 |
echo "tnc.value $TNC" |
| 116 |
echo "tnctx.value $TNCTX" |
| 117 |
|
