Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snmp asterisk script: pjsip #375

Open
hb9eue opened this issue Sep 20, 2021 · 4 comments
Open

snmp asterisk script: pjsip #375

hb9eue opened this issue Sep 20, 2021 · 4 comments

Comments

@hb9eue
Copy link

hb9eue commented Sep 20, 2021

Hi Team

chan_sip is depreciated. I guess everyone is using pjsip nowadays.

I altered the asterisk script to return the number of pjsip endpoints. But that is not being graphed. Instead I still get the former counters with nan counts. So I guess there is a counterpart to the asterisk snmp extend script. Could you please point me to it?

-Benoit-

@SonicJoe
Copy link

SonicJoe commented Jul 6, 2022

I too have the same issue. It looks like there is quite a few files to change on the back end to make this work. If I find some bandwidth, I may try my hand at it, but if you are interested here is the linked changes from when iax2 was added showing all the files that they needed to modify on the server side: librenms/librenms#11078

@hb9eue
Copy link
Author

hb9eue commented Jul 8, 2022

Yes indeed... I once fixed it by deleting all the relevant rrd and had them re-created. But when I updated librenms all was broken again so I finally gave up :-)
But I suppose if someone submitted an easy patch containing all what is needed to count pjsip channels etc. that would be fixed easily.
Same here, if I find some spare bandwith on my voice project, I might have an deeper look into it.

@si458
Copy link

si458 commented Dec 31, 2022

im wondering if anybody has sorted/updated the asterisk script yet?
asterisk 18 with freepbx has fully removed SIP now and only uses PJSIP

@si458
Copy link

si458 commented Jun 19, 2024

if anybody is wondering, i discovered this link in the librenms forum for asterisk and pjsip!
https://community.librenms.org/t/asterisk-pjsip-librenms/19029
script works a treat!

edit: code in case forum vanishes, just replace all of asterisk content with below

#!/bin/bash

ASCLI=/usr/sbin/asterisk

if [ -f $ASCLI ];
then
    $ASCLI -rx "core show uptime" > /dev/null
    if [ $? -ne 0 ]; then
        # Asterisk not running, silently exit.
        exit 0
    fi

    echo "<<<asterisk>>>"
    $ASCLI -rx "core show channels" | awk '/active calls/ { print "Calls=" $1 } /active channels/ { print "Channels=" $1}'
    $ASCLI -rx "pjsip show endpoints" | awk '/Objects found:/ { print "SipPeers=" $3 }'
    $ASCLI -rx 'pjsip show endpoints' | grep "Avail" | wc -l | (read foo; echo SipMonOnline=$foo; )
    $ASCLI -rx 'pjsip show endpoints' | grep "Unavailable" | wc -l | (read foo; echo SipMonOffline=$foo; )
    echo "SipUnMonOnline=0"
    echo "SipUnMonOffline=0"
    $ASCLI -rx 'iax2 show peers' | awk '/iax2 peers/ { gsub("\\[",""); gsub("\\]",""); print "Iax2Peers=" $1 "\nIax2Online=" $4 "\nIax2Offline=" $6 "\nIax2Unmonitored=" $8}'

else
   exit 0
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants