<div dir="ltr">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.<div><br><div style>On the Freeswitch server install the opsview-agent & set service to auto start</div>
<div style><br></div><div style>Create check_freeswitch_sessions.sh in /usr/local/nagios/libexec & chkmod +x the script</div><div style>--------------------------------------------------------<br></div><div style><div>
#!/bin/bash</div><div><br></div><div>set fsStatus=" "</div><div>/usr/local/freeswitch/bin/fs_cli -x "show calls count" > /tmp/fsStatus</div><div>if [ $? -ne 0 ]; then</div><div> echo "Critical: Freeswitch not responding!"</div>
<div> rm /tmp/fsStatus</div><div> exit -1</div><div>fi</div><div><br></div><div>fsCalls=`grep "total."</tmp/fsStatus`</div><div><br></div><div>#Strip unwanted chars from the channels responses to get pure ints.</div>
<div>fsCalls=${fsCalls/ total./}</div><div><br></div><div># Build a message up</div><div>message="Active Sessions: $fsCalls"</div><div>echo $message</div><div><br></div><div>rm /tmp/fsStatus</div><div>#exit $fsCalls</div>
<div>exit 0</div><div>--------------------------------------------------------<br></div><div><br></div><div>The add the following to /usr/local/nagios/nrpe.cfg<br></div><div style><br></div><div style>--------------------------------------------------------<br>
</div><div style>command[check_freeswitch_sessions]=/usr/local/nagios/libexec/check_freeswitch_Sessions.sh<br></div></div><div style>--------------------------------------------------------<br></div><div style><br></div>
<div style>
On Opsview server use check_nrpe service check to remotely run the check_freeswitch_sessions service check.</div><div style><br></div><div style>Then on your opsview server</div><div><br></div><div>edit /usr/local/nagios/etc/map and add the following<br>
</div><div>--------------------------------------------------------</div><div><div># Service type: Freeswitch Sessions</div><div># ouput:Active Sessions: 0</div><div>/output:Active.*?(\d+)/</div><div>and push @s, [ "session",</div>
<div> [ "sessions", GAUGE, $1 ] ];</div><div>--------------------------------------------------------</div><div><br><div><div><span style="border-collapse:collapse"><span lang="EN-US"><font face="'times new roman', serif"><font color="#999999"><b>Alex Ynema</b></font></font></span><span lang="EN-US"><font face="'times new roman', serif"><font color="#999999"><b> </b>| </font></font></span><span lang="EN-US"><font face="'times new roman', serif"><font color="#999999">IT Consultant</font></font></span><span lang="EN-US"><font face="'times new roman', serif"><font color="#999999"><br>
</font></font></span><span lang="EN-US"><font face="'times new roman', serif"><font color="#999999"><a href="mailto:alex@opensystems.net.au" target="_blank">alex@opensystems.net.au</a><br></font></font></span></span></div>
<div><br></div><font face="'times new roman', serif"><font color="#999999">Level 1, 409-411 Oxford Street, Mount Hawthorne WA 6016</font></font></div><div><font face="'times new roman', serif"><font color="#999999">Office: +61 8 9427 2500<br>
Mobile: +61 404 796 894<br></font></font><div><a href="http://www.ynema.net/" target="_blank"></a><font color="#999999" face="'times new roman', serif"><br></font><div><a href="http://www.ynema.net/" target="_blank"></a><font color="#999999" face="'times new roman', serif">IT Consultant for Open Systems Support<br>
</font><div><font face="'times new roman', serif"><font color="#999999"><a href="http://www.opensystems.net.au/" target="_blank">www.opensystems.net.au</a></font></font></div></div></div></div></div>
</div></div></div>