<div dir="ltr">I thought I&#39;d post this for people reference. I&#39;ve configured opsview (Nagios) to monitor my current sessions &amp; graph it so I can match performance &amp; usage.<div><br><div style>On the Freeswitch server install the opsview-agent &amp; set service to auto start</div>

<div style><br></div><div style>Create check_freeswitch_sessions.sh in /usr/local/nagios/libexec &amp; chkmod +x the script</div><div style>--------------------------------------------------------<br></div><div style><div>

#!/bin/bash</div><div><br></div><div>set fsStatus=&quot; &quot;</div><div>/usr/local/freeswitch/bin/fs_cli -x &quot;show calls count&quot; &gt; /tmp/fsStatus</div><div>if [ $? -ne 0 ]; then</div><div>        echo &quot;Critical: Freeswitch not responding!&quot;</div>

<div>        rm /tmp/fsStatus</div><div>        exit -1</div><div>fi</div><div><br></div><div>fsCalls=`grep &quot;total.&quot;&lt;/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=&quot;Active Sessions: $fsCalls&quot;</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, [ &quot;session&quot;,</div>

<div>               [ &quot;sessions&quot;, GAUGE, $1 ] ];</div><div>--------------------------------------------------------</div><div><br><div><div><span style="border-collapse:collapse"><span lang="EN-US"><font face="&#39;times new roman&#39;, serif"><font color="#999999"><b>Alex Ynema</b></font></font></span><span lang="EN-US"><font face="&#39;times new roman&#39;, serif"><font color="#999999"><b> </b>| </font></font></span><span lang="EN-US"><font face="&#39;times new roman&#39;, serif"><font color="#999999">IT Consultant</font></font></span><span lang="EN-US"><font face="&#39;times new roman&#39;, serif"><font color="#999999"><br>

</font></font></span><span lang="EN-US"><font face="&#39;times new roman&#39;, 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="&#39;times new roman&#39;, serif"><font color="#999999">Level 1, 409-411 Oxford Street, Mount Hawthorne WA 6016</font></font></div><div><font face="&#39;times new roman&#39;, 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="&#39;times new roman&#39;, serif"><br></font><div><a href="http://www.ynema.net/" target="_blank"></a><font color="#999999" face="&#39;times new roman&#39;, serif">IT Consultant for Open Systems Support<br>

</font><div><font face="&#39;times new roman&#39;, 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>