Random Project

Apply following patch for Asterisk from 1.6

— check_asterisk_peers 2011-11-05 11:56:16.352105211 +0100
+++ check_asterisk_peers.sh 2011-11-05 11:56:11.376105311 +0100
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# Check asterisk peers plugin for Nagios.
# Written by Chad Phillips ([email protected])
@@ -7,6 +7,7 @@
ASTERISK=/usr/sbin/asterisk

PROGPATH=`dirname $0`
+PROGPATH=”/usr/lib/nagios/plugins”
REVISION=`echo ‘$Revision: 2 $’ | sed -e ‘s/[^0-9.]//g’`

. $PROGPATH/utils.sh
@@ -333,9 +334,11 @@
if [ “$registration_verified” ]; then
# Have to cut off registration name at 12 characters, so let’s hope
# it’s still unique!
– cut_user=${user:0:12}
+ #cut_user=${user:0:12}
+ cut_user=${r:0:12}
# This regex isn’t perfect, but it does the trick ok.
– status=`echo “$command_output” | grep “^${uri}:[[:digit:]].+[[:space:]].+${cut_user}[[:space:]].+” | awk ‘{print $4;}’`
+ #status=`echo “$command_output” | grep “^${uri}:[[:digit:]].+[[:space:]].+${cut_user}[[:space:]].+” | awk ‘{print $4;}’`
+ status=`echo “$command_output” | grep “^${uri}:[[:digit:]].+[[:space:]].+[[:alpha:]].+${cut_user}[[:space:]].+” | awk ‘{print $5;}’`
if [ “$status” = “Registered” ]; then
if [ “$test_ok” ]; then
test_ok=”${test_ok}, $r”