Hi

Attached is the mrtg to kannel script. It will pass smsc info to mrtg
for graphing.

I assume that you have a working installation of MRTG.

You can test it from shell if you do have php_cli installed. If not
you MUST install it order to have the script work, with:

# mrtg_kannel_1.php txrx smsc_id

You should get something like:

[...@test]/usr/local/mrtg-2/scripts# ./mrtg_kannel_1.php txrx smsc1
1132                     << TX messages since las check
122                      <<  RX messages since las check
23d 14h 2m 15s    <<  Kannel Uptime
SMSC: smsc1      <<  SMSC ID
[r...@test-tts]

where:

1st arg is one of the following:
txrx:        get sent & received messages for the specified smsc
fq:          get failed & queued messages for the specified smsc (Not
valid for smsc = all)
qmomt:  get MT queued & MO queued messages (only for smsc = all)

and the seccond arg is the smsc_id as on kannel conf or "all¨  to get
a graph for all the smsc's summed up

Example of mrtg config for TX & RX for SMSC1:
You might need to adjust MaxBytes & absmax  values.

####### TEST SMSC 1 MONITOR SMSC
######################################################################
# System:  Kannel xxxx
# Description:  xxxx
# Contact:  xxxx
# Location: xxxx
######################################################################

Title[smsc1.txrx]: Contador Mensajes TX y RX en smsc smsc1
PageTop[smsc1.txrx]: <H1>TX y RX SMSC1</H1>
       <P>Transmitted & Received Messages for SMSC1

MaxBytes1[smsc1.txrx]: 500
MaxBytes2[smsc1.txrx]: 500
AbsMax[smsc1.txrx]: 5000
Options[smsc1.txrx]: unknaszero,gauge,growright,perminute
WithPeak[smsc1.txrx]: ymwd
##################################################################
Target[smsc1.txrx]: `/usr/local/mrtg-2/scripts/mrtg_kannel.php txrx smsc1`

YLegend[smsc1.txrx]: Mensajes SMSC1
ShortLegend[smsc1.txrx]: msj
Legend1[smsc1.txrx]: Msjs. Enviados
Legend2[smsc1.txrx]: Msjs. Recibidos
Legend3[smsc1.txrx]: Maximal 5 Minute Mensajes Enviados
Legend4[smsc1.txrx]: Maximal 5 Minute Mensajes Recibidos
LegendI[smsc1.txrx]: &nbsp;Mensajes Enviados:
LegendO[smsc1.txrx]: &nbsp;Mensajes Recibidos:

######################################################################
####### TEST SMSC 1 MONITOR SMSC FAILED QUEUED
######################################################################

Title[smsc1.fq]: Contador Mensajes FALLADOS Y ENCOLADOS en smsc1
PageTop[smsc1.fq]: <H1>Fallados y Encolados SMSC 1</H1>
       <P>test mensajes fallados encolados smsc1

MaxBytes[smsc1.fq]: 500
AbsMax[smsc1.fq]: 10000
Options[smsc1.fq]: unknaszero,gauge,growright
WithPeak[smsc1.fq]: ymwd

##################################################################
Target[smsc1.fq]: `/usr/local/mrtg-2/scripts/mrtg_kannel.php fq smsc1`

YLegend[smsc1.fq]: SMSC 1 Fallados y Encolados
ShortLegend[smsc1.fq]: msj
Legend1[smsc1.fq]: Mensajes fallados
Legend2[smsc1.fq]: Mensajes Encolados
Legend3[smsc1.fq]: Maximal 5 Minute Mensajes fallados
Legend4[smsc1.fq]: Maximal 5 Minute Mensajes encolados
LegendI[smsc1.fq]: &nbsp;Mensajes Fallidos:
LegendO[smsc1.fq]: &nbsp;Mensajes Encolados:

######################################################################
####### ALL SMSC  MONITOR SMSC TX & RX
######################################################################

Title[all.txrx]: Contador Mensajes TX y RX en Todos los smsc
PageTop[all.txrx]: <H1>TX y RX Todos SMSC</H1>
       <P>test mensajes todos TX y RX

MaxBytes[all.txrx]: 10000
AbsMax[all.txrx]: 10000
Options[all.txrx]: unknaszero,gauge,growright
WithPeak[all.txrx]: ymwd

##################################################################
Target[all.txrx]: `/usr/local/mrtg-2/scripts/mrtg_kannel_1.php txrx all`

YLegend[all.txrx]: Todos los SMSCs TX y RX
ShortLegend[all.txrx]: msj
Legend1[all.txrx]: Total Mensajes Enviados
Legend2[all.txrx]: Total Mensajes Recibidos
Legend3[all.txrx]: Maximal 5 Minute Mensajes Enviados
Legend4[all.txrx]: Maximal 5 Minute Mensajes Recibidos
LegendI[all.txrx]: &nbsp;Mensajes Enviados:
LegendO[all.txrx]: &nbsp;Mensajes Recibidos:


I'm not a programmer nor a scripting guy so the script can look
weird/strange/confuse/etc/etc/etc.. :-(( ... but It works  : - ))

Finally, in my kannel config, in the received counter I get the
Incomming + Outgoing... :( I don't know why, so for showing the right
value, I make the difference between Inc & out counters..

If someone use the script an enhaced it, please share the result and
if possible, keep my credits on it ;)

Regards

Alvaro

<<attachment: mrtg_kannel_1.php>>

Reply via email to