Projet

Général

Profil

Révision 1c0440a7

ID1c0440a798a2e9964ee1f18c9a382c9457194259
Parent 8b0547c5
Enfant fdd3eaf4

Ajouté par Robert Kilian il y a plus de 13 ans

Initial commit of Xastir plugin

Voir les différences:

plugins/xastir/README
1
Be sure to correctly edit the STATION_CALL, XASTIRDIR, and LOGDIR variables
2

  
3
STATION_CALL: The callsign used by Xastir (include suffix if one is in use)
4
XASTIRDIR: The directory where Xastir's data, config, etc files are found.  Typically ~/.xastir
5
LOGDIR:  Logs are typically stored in ~/.xastir/logs.  Ensure that permissions are set appropriately to allow the munin user to read these logs
plugins/xastir/xastir
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
# Location of active instance of Xastir
27
XASTIRDIR="/home/USERNAME/.xastir"
28

  
29
# Grab the station's callsign from Xastir config
30
# this currently does not derive the station call correctly when called by the server, but works using munin-run...
31
#STATION_CALL=`grep ^STATION_CALLSIGN:.* $XASTIRDIR/config/xastir.cnf | awk -F":" '{print $2}'`
32
STATION_CALL=""
33

  
34
# Location of Xastir's logs (this can be a symlink to where Xastir actually writes the logs)
35
LOGDIR="/var/log/xastir/logs"
36

  
37

  
38
case $1 in
39
   config)
40
        cat <<'EOM'
41

  
42
graph_title Xastir Packet Stats
43
graph_vlabel Packets
44
graph_category ham_radio
45
graph_scale no
46
graph_printf %.0lf
47

  
48
igatetonet.label IGate - RF to Net
49
igatetonet.type COUNTER
50
igatetonet.min 0
51
igatetonet.max 500
52
igatetonet.LINE1
53

  
54
message.label Message RX
55
message.type COUNTER
56
message.min 0
57
message.max 500
58
message.draw LINE1
59

  
60
messagetx.label Message TX
61
messagetx.type COUNTER
62
messagetx.min 0
63
messagetx.max 500
64
messagetx.draw LINE1
65

  
66
net.label Net RX
67
net.type COUNTER
68
net.min 0
69
net.max 500
70
net.draw LINE1
71

  
72
nettx.label Net TX
73
nettx.type COUNTER
74
nettx.min 0
75
nettx.max 500
76
nettx.draw LINE1
77

  
78
tnc.label TNC RX
79
tnc.type COUNTER
80
tnc.min 0
81
tnc.max 500
82
tnc.draw LINE1
83

  
84
tnctx.label TNC TX
85
tnctx.type COUNTER
86
tnctx.min 0
87
tnctx.max 500
88
tnctx.draw LINE1
89

  
90
EOM
91
        exit 0;;
92
esac
93

  
94
# Parse logs for various values
95
IGATETONET=`cat $LOGDIR/igate.log | grep -e '^IGATE RF' | wc -l`
96
MESSAGE=`cat $LOGDIR/message.log | grep -v '^\#' | grep -v ^$STATION_CALL | wc -l`
97
MESSAGETX=`cat $LOGDIR/message.log | grep -v '^\#' | grep ^$STATION_CALL | wc -l`
98
NET=`cat $LOGDIR/net.log | grep -v '^\#' | grep -v ^$STATION_CALL | wc -l`
99
NETTX=`cat $LOGDIR/net.log | grep -v '^\#' | grep ^$STATION_CALL | wc -l`
100
TNC=`cat $LOGDIR/tnc.log | grep -v '^\#' | grep -v ^$STATION_CALL | wc -l`
101
TNCTX=`cat $LOGDIR/tnc.log | grep -v '^\#' | grep ^$STATION_CALL | wc -l`
102

  
103
# Display values 
104
echo "igatetonet.value $IGATETONET"
105
echo "message.value $MESSAGE"
106
echo "messagetx.value $MESSAGETX"
107
echo "net.value $NET"
108
echo "nettx.value $NETTX"
109
echo "tnc.value $TNC"
110
echo "tnctx.value $TNCTX"
111

  

Formats disponibles : Unified diff