Git Product home page Git Product logo

sipnagios's Introduction

sipnagios

Nagios Plugin to check Call Quality in SIP VoIP (compatible with check_mk, Zabbix, etc)

sipnagios implements the Nagios plugin API for monitoring and performance data.

sipnagios.c is a modification of the original siprtp.c sample in pjproject distribution. Supposedly, it works on Linux, Windows, and anywhere you can compile pjproject on.

It makes a call, checks all the various resulting values (mos, rtt, pdd, tta, jitter, packet loss, bytes and packets transferred, and so on). It verifies these values are included into acceptable, warning, or critical ranges.

If the call has gone well, sipnagios print performance data for Nagios graphs, and returns 0.

If the call fails, or if its measured values are not inside acceptable ranges, it exits with Nagios conventional WARNING or CRITICAL values.

Zabbix seems not able to gather historical performances data from external checks, but will show last call values in GUI

USAGE:

 sipnagios [options] SIPURL

 Call options:
   --duration=SEC,   -d    Set maximum call duration in seconds (default:40)

 Address and ports options:
   --local-port=PORT,-p    Set local SIP port (default: 5060)
   --rtp-port=PORT,  -r    Set start of RTP port (default: 4000)
   --ip-addr=IP,     -i    Set local IP address to use (otherwise it will
                           try to determine local IP address from hostname)

 Local user options:
   --local-user=USER,       -u    Set local SIP user (default: alice)
   --local-password=PASSWD, -w    Set local SIP user password (default: 1234)
   --local-siprealm=REALM,  -s    Set local SIP user SIP realm (default: atlanta.example.com)

 Logging Options:
   --log-level=N,    -l    Set log verbosity level (default=1)
   --app-log-level=N       Set app log verbosity (default=1)
   --log-file=FILE         Write log to file FILE

NAGIOS RANGES OPTIONS DEFAULTS:

-c --rxmosWARN = 4.0
-g --txmosWARN = 4.0
-t --rxmosCRIT = 3.6
-m --txmosCRIT = 3.6

-A --durationmsWARN = 40000
-B --pddmsWARN = 8000
-C --ttamsWARN = 11000
-D --rxpktsWARN = 1000
-E --rxbytesWARN = 150000
-F --rxlosspctWARN = 1.5
-G --rxduppctWARN =  1.5
-H --rxreorderpctWARN =1.5
-I --rxjitavgWARN =   15.1
-L --txpktsWARN =  1000
-M --txbytesWARN = 150000
-N --txlosspctWARN = 1.5
-O --txduppctWARN =  1.5
-P --txreorderpctWARN =1.5
-Q --txjitavgWARN =  15.1
-R --rttmeanWARN =   150.1

-S --durationmsCRIT = 20000
-T --pddmsCRIT = 16000
-U --ttamsCRIT = 20000
-V --rxpktsCRIT = 500
-Z --rxbytesCRIT = 75000
-K --rxlosspctCRIT = 3.0
-J --rxduppctCRIT =  3.0
-X --rxreorderpctCRIT =3.0
-Y --rxjitavgCRIT =   30.1
-v --txpktsCRIT =  500
-z --txbytesCRIT = 75000
-k --txlosspctCRIT = 3.0
-j --txduppctCRIT =  3.0
-x --txreorderpctCRIT =3.0
-y --txjitavgCRIT =  30.1
-b --rttmeanCRIT =   300.1

==> rx and tx mos, durationms, rx and tx pkts and bytes becomes WARNING and CRITICAL if they're measured as LOWER than threshold
==> all other values becomes not OK if they are measured as HIGHER than threshold

Eg:
sipnagios --rtp-port=4000 --local-port=8090 --ip-addr=188.166.74.47 --local-user=9599 --local-siprealm=acme.cloudpbx.opentelecom.it --local-password=cAcyAgaC46AKuRk sip:[email protected]:5030
(sipnagios is brought to you by Giovanni Maruzzelli. Enjoy!)

HOW TO COMPILE SIPNAGIOS on DEBIAN:

(NB: To compile on Windows you'll need to come out with some other way to generate a uuid for the Call-ID. In Linux, uuid_generate/uuid_unparse_lower are used. Patch welcome!)

apt install python-dev gcc make gcc binutils build-essential git wget unzip uuid-dev

cd /usr/src
git clone https://github.com/gmaruzz/sipnagios.git

wget https://github.com/pjsip/pjproject/archive/refs/tags/2.11.zip
unzip 2.11.zip
cd pjproject-2.11/
./configure
CFLAGS="$CFLAGS -fPIC -DPJ_LOG_MAX_LEVEL=3" make dep

cp ../sipnagios/sipnagios.c pjsip-apps/src/samples/
cp ../sipnagios/Samples.mak pjsip-apps/build/

CFLAGS="$CFLAGS -fPIC -DPJ_LOG_MAX_LEVEL=3" make 
./pjsip-apps/bin/samples/x86_64-unknown-linux-gnu/sipnagios --help

Install in CheckMk

cp sipnagios /omd/sites/YOURSITENAME/local/lib/nagios/plugins/
chmod +x /omd/sites/YOURSITENAME/local/lib/nagios/plugins/sipnagios

WATO -> Host & Service Parameters -> Active Checks (HTTP, TCP, etc)

TODO

  • Enhance Zabbix compatibility (if possible/needed)
  • Let's use pjproject media interface for streaming an audio file and recording into a file, so we'll reuse all RTCP pjsip's goodies

CREDITS

mos calculation is scraped from Julien Chavanton work (VoIP Patrol, on GitHub too) I can't even understand :) (merci Julien!) https://github.com/jchavanton/voip_patrol/

pjproject: https://github.com/pjsip/pjproject

sipnagios's People

Contributors

gmaruzz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sipnagios's Issues

Add custom headers

Hi,

Great application! I was looking for something like this for a long time.

One thing that would actually make it perfect for my use case. I need to add P-Asserted-Identity to the outgoing INVITE to make it work with my service provider. In the simplest case it could be set to the same value as From header.
Could the code be extended to include the P-Asserted-Identity header?

Thank you in advance.

txjitavg and txjitmax have unreasonable values

Hi,

after running the sipnagios I get the unreasonable values for txjitavg=97272.6ms txjitmax=481182.0ms more then actual call duration of 10 seconds
Also call disconnection shows Reason=603 (Decline) although it was disconnected from the sipnagios with BYE.

root@status:/usr/src/sipnagios/123/sipnagios# sipnagios --rtp-port=4000 --local-port=8090 --ip-addr=192.168.3.43 --local-user=+123456789 --local-siprealm=sip.test.com --local-password=cAcyAgaC46AKuRk sip:[email protected]:5060 --log-level=9 --app-log-level=9 -d 10
19:16:48.278 sipnagios.c !SIP UDP listening on 192.168.3.43:8090
19:16:48.279 sipnagios.c Making 1 calls to sip:[email protected]:5060..
19:16:50.346 sipnagios.c !....Call #0 connected in 2067 ms
19:17:00.359 sipnagios.c ....Call #0 disconnected. Reason=603 (Decline)
19:17:00.359 sipnagios.c ....Call #0 monitoring:
CRIT txjitavg=97272.6 MOS[rx=4.50 tx=4.50] Call To: sip:[email protected];tag=f22105bc TIME[pddms=47ms ttams=2067ms durationms=10014ms] RX[rxmos=4.50 rxpkts=501 rxbytes=80160B rxloss=0 rxlosspct=0.0% rxdup=0 rxduppct=0.0% rxreorder=0 rxreorderpct=0.0% rxjitmin=0.0ms rxjitavg=0.0ms rxjitmax=1.0ms] TX[txmos=4.50 txpkts=495 txbytes=79200B txloss=0 txlosspct=0.0% txdup=0 txduppct=0.0% txreorder=0 txreorderpct=0.0% txjitmin=0.0ms txjitavg=97272.6ms txjitmax=481182.0ms] RTT[rttmin=13.1ms rttmean=13.5ms rttmax=13.8ms] |durationms=10014ms pddms=47ms ttams=2067ms rxmos=4.50 rxpkts=501 rxbytes=80160B rxloss=0 rxlosspct=0.0% rxdup=0 rxduppct=0.0% rxreorder=0 rxreorderpct=0.0% rxjitmin=0.0ms rxjitavg=0.0ms rxjitmax=1.0ms txmos=4.50 txpkts=495 txbytes=79200B txloss=0 txlosspct=0.0% txdup=0 txduppct=0.0% txreorder=0 txreorderpct=0.0% txjitmin=0.0ms txjitavg=97272.6ms txjitmax=481182.0ms rttmin=13.1ms rttmean=13.5ms rttmax=13.8ms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.