MRTG Support for Aquila

From Aquila Homepage

Jump to: navigation, search

To add Aquila to your MRTG installation, you need the following files:

WARNING: These scripts will only work correctly if you are using a recent daemontools installation. If these do not work, replace the contents of the dir variable in aquila_mem and aquila_connections with the correct path to your configuration directory.

/etc/mrtg/mrtg.cfg.aquila

Language: english

Target[aquila_mem]: `/etc/mrtg/aquila_mem`
Title[aquila_mem]: Aquila Memory Usage
PageTop[aquila_mem]: <h1>Aquila Memory Usage<h1>
YLegend[aquila_mem]: Memory in KB
ShortLegend[aquila_mem]: &nbsp;&nbsp;&nbsp;
kmg[aquila_mem]: kB,MB,GB
LegendI[aquila_mem]: Memory:
LegendO[aquila_mem]: Peak:
Options[aquila_mem]: nopercent,growright,nobanner,nolegend,noinfo,gauge 

Target[aquila_connections]: `/etc/mrtg/aquila_connections`
Title[aquila_connections]: Aquila TCP Connections
PageTop[aquila_connections]: <h1>Aquila TCP Connections<h1>
YLegend[aquila_connections]: TCP Connections
ShortLegend[aquila_connections]: &nbsp;&nbsp;&nbsp;
LegendI[aquila_connections]: 
LegendO[aquila_connections]: TCP
Options[aquila_connections]: nopercent,growright,nobanner,nolegend,noinfo,gauge 

/etc/mrtg/aquila_mem

#!/bin/bash

dir=/home/aquila/service
pid=`cat $dir/aquila.pid`

size=`cat /proc/$pid/status | grep VmSize | cut -d: -f 2`
peak=`cat /proc/$pid/status | grep VmPeak | cut -d: -f 2`

echo $size | cut -d ' ' -f 1
if [ "$peak" != "" ]
then
        echo $peak | cut -d ' ' -f 1
else
        echo 0
fi      
echo `uptime | cut -d"," -f 1,2`
echo aquila_mem

/etc/mrtg/aquila_connections

#!/bin/bash

dir=/home/aquila/service
pid=`cat $dir/aquila.pid`

count=`ls /proc/$pid/fd | wc -l`

echo $(($count - 3))
echo $(($count - 3))
echo `uptime | cut -d"," -f 1,2`
echo aquila_connections


In your main mrtg.cfg file, add the following line:

Include: /etc/mrtg/mrtg.cfg.aquila

Make sure that both aquila_mem and aquila_connections are executable.

 chmod +rx /etc/mrtg/aquila_mem /etc/mrtg/aquila_connections