I already borrowed the script from someone here anyway so feel free to use it. If you come up with any good changes or additions reply with them here so others can use that too.

Alex Ynema | IT Consultant
alex@opensystems.net.au

Mobile: +61 404 796 894

IT Consultant for Open Systems Support
www.opensystems.net.au

On 17/05/2013 2:27 PM, "Telecube - John" <john@telecube.com.au> wrote:
Nice, if it's ok with you I'm going to 'borrow' this and make it work with Cactus

- John

On 17/05/13 3:24 PM, Alex Ynema wrote:
I thought I'd post this for people reference. I've configured opsview (Nagios) to monitor my current sessions & graph it so I can match performance & usage.

On the Freeswitch server install the opsview-agent & set service to auto start

Create check_freeswitch_sessions.sh in /usr/local/nagios/libexec & chkmod +x the script
--------------------------------------------------------
#!/bin/bash

set fsStatus=" "
/usr/local/freeswitch/bin/fs_cli -x "show calls count" > /tmp/fsStatus
if [ $? -ne 0 ]; then
        echo "Critical: Freeswitch not responding!"
        rm /tmp/fsStatus
        exit -1
fi

fsCalls=`grep "total."</tmp/fsStatus`

#Strip unwanted chars from the channels responses to get pure ints.
fsCalls=${fsCalls/ total./}

# Build a message up
message="Active Sessions: $fsCalls"
echo $message

rm /tmp/fsStatus
#exit $fsCalls
exit 0
--------------------------------------------------------

The add the following to /usr/local/nagios/nrpe.cfg

--------------------------------------------------------
command[check_freeswitch_sessions]=/usr/local/nagios/libexec/check_freeswitch_Sessions.sh
--------------------------------------------------------

On Opsview server use check_nrpe service check to remotely run the check_freeswitch_sessions service check.

Then on your opsview server

edit /usr/local/nagios/etc/map and add the following
--------------------------------------------------------
# Service type: Freeswitch Sessions
#   ouput:Active Sessions: 0
/output:Active.*?(\d+)/
and push @s, [ "session",
               [ "sessions", GAUGE, $1 ] ];
--------------------------------------------------------

Alex Ynema | IT Consultant
alex@opensystems.net.au

Level 1, 409-411 Oxford Street, Mount Hawthorne WA 6016
Office: +61 8 9427 2500
Mobile: +61 404 796 894

IT Consultant for Open Systems Support


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org