Compare commits
No commits in common. "4186810aaa109ba3f515252a80634e32800c4039" and "fd9559312ea6aab72d7ea0e1513e4dde86bafe6f" have entirely different histories.
4186810aaa
...
fd9559312e
3 changed files with 5 additions and 26 deletions
19
README.md
19
README.md
|
@ -5,27 +5,10 @@ This repository provide a collection of scripts could be used as Icinga/Nagios c
|
|||
## Installation
|
||||
|
||||
```
|
||||
apt-get install git sed sudo
|
||||
git clone https://gitea.zionetrix.net/bn8/check_asterisk.git /usr/local/src/check_asterisk
|
||||
mkdir -p /usr/local/lib/nagios/plugins
|
||||
cd /usr/local/src/check_asterisk
|
||||
for i in /usr/local/src/check_asterisk/check_*; do ln -s /usr/local/src/check_asterisk/$i /usr/local/lib/nagios/plugins/$(basename $i); done
|
||||
cat << EOF > /etc/sudoers.d/nagios-asterisk
|
||||
nagios ALL=NOPASSWD: /usr/local/lib/nagios/plugins/check_sip_connected_peers
|
||||
nagios ALL=NOPASSWD: /usr/local/lib/nagios/plugins/check_sip_latency
|
||||
nagios ALL=NOPASSWD: /usr/local/lib/nagios/plugins/check_sip_peers
|
||||
nagios ALL=NOPASSWD: /usr/local/lib/nagios/plugins/check_sip_peer_simultaneous_channels
|
||||
nagios ALL=NOPASSWD: /usr/local/lib/nagios/plugins/check_sip_zombie_channels
|
||||
EOF
|
||||
chmod 0400 /etc/sudoers.d/nagios-asterisk
|
||||
cat << EOF > /etc/nagios/nrpe.d/asterisk.cfg
|
||||
command[check_mytrunk]=sudo /usr/local/lib/nagios/plugins/check_sip_latency mytrunk
|
||||
command[check_mytrunk_simultaneous_channels]=sudo /usr/local/lib/nagios/plugins/check_sip_peer_simultaneous_channels -w8 -c10 mytrunk
|
||||
command[check_zombie_channels]=sudo /usr/local/lib/nagios/plugins/check_sip_zombie_channels -w2 -c3
|
||||
command[check_mysite_sip_connected_peers]=sudo /usr/local/lib/nagios/plugins/check_sip_peers mysite 1.2.3.4
|
||||
command[check_switchboard_peers]=sudo /usr/local/lib/nagios/plugins/check_sip_peers -w2 -c1 -W100 -C200 phone1 phone2 phone3
|
||||
EOF
|
||||
ln -s /usr/local/src/check_asterisk/hangup_channels /usr/local/sbin/hangup_channels
|
||||
for i in /usr/local/src/check_asterisk/check_*; do ln -s $(realpath $i) /usr/local/lib/nagios/plugins/$(basename $i); done
|
||||
```
|
||||
|
||||
## Copyright
|
||||
|
|
|
@ -102,12 +102,8 @@ do
|
|||
fi
|
||||
done
|
||||
debug "Nb connected peers : $nb_connected"
|
||||
avg_latency=0
|
||||
if [[ $nb_connected -gt 0 ]]
|
||||
then
|
||||
let avg_latency=sum_latency/nb_connected
|
||||
debug "Average latency of connected peers : $avg_latency ($sum_latency / $nb_connected)"
|
||||
fi
|
||||
let avg_latency=sum_latency/nb_connected
|
||||
debug "Average latency of connected peers : $avg_latency ($sum_latency / $nb_connected)"
|
||||
|
||||
STATE=OK
|
||||
MSG="$nb_connected peer(s) connected on $SITE_NAME with an average latency of $avg_latency ms|'connected peers':$nb_connected;$WARNING_PEER_NUMBER;$CRITICAL_PEER_NUMBER;0;0 'average latency':$avg_latency;$WARNING_LATENCY;$CRITICAL_LATENCY;0;0"
|
||||
|
|
|
@ -61,7 +61,7 @@ latency=`/usr/bin/sudo -u root /usr/sbin/rasterisk -rnx "sip show peer $PEER"|gr
|
|||
|
||||
if [ ! -n "$latency" ]
|
||||
then
|
||||
echo "UNKNOWN - SIP peer $PEER unknown"
|
||||
/bin/echo "SIP Latency UNKNOWN"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
|
@ -82,5 +82,5 @@ else
|
|||
exitcode=0
|
||||
fi
|
||||
|
||||
echo "${nstatus} - SIP Latency is ${nstatus}: $details | latency=${latency}ms"
|
||||
/bin/echo "SIP Latency ${nstatus} : $details | latency=${latency}ms"
|
||||
exit $exitcode
|
||||
|
|
Loading…
Reference in a new issue