<div dir="ltr"><p dir="ltr">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.<br></p>
<p dir="ltr">Alex Ynema | IT Consultant<br>
<a href="mailto:alex@opensystems.net.au" target="_blank">alex@opensystems.net.au</a></p>
<p dir="ltr">Mobile: <a href="tel:%2B61%20404%20796%20894" value="+61404796894" target="_blank">+61 404 796 894</a></p>
<p dir="ltr">IT Consultant for Open Systems Support<br>
<a href="http://www.opensystems.net.au" target="_blank">www.opensystems.net.au</a></p>
<div class="gmail_quote">On 17/05/2013 2:27 PM, &quot;Telecube - John&quot; &lt;<a href="mailto:john@telecube.com.au" target="_blank">john@telecube.com.au</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Nice, if it&#39;s ok with you I&#39;m going to &#39;borrow&#39; this and make it
    work with Cactus<br>
    <br>
    - John<br>
    <br>
    <div>On 17/05/13 3:24 PM, Alex Ynema wrote:<br>
    </div>
    <blockquote type="cite">
      <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>On the Freeswitch server install the
            opsview-agent &amp; set service to auto start</div>
          <div><br>
          </div>
          <div>Create check_freeswitch_sessions.sh in
            /usr/local/nagios/libexec &amp; chkmod +x the script</div>
          <div>--------------------------------------------------------<br>
          </div>
          <div>
            <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><br>
            </div>
            <div>--------------------------------------------------------<br>
            </div>
            <div>command[check_freeswitch_sessions]=/usr/local/nagios/libexec/check_freeswitch_Sessions.sh<br>
            </div>
          </div>
          <div>--------------------------------------------------------<br>
          </div>
          <div><br>
          </div>
          <div>
            On Opsview server use check_nrpe service check to remotely
            run the check_freeswitch_sessions service check.</div>
          <div><br>
          </div>
          <div>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: <a href="tel:%2B61%208%209427%202500" value="+61894272500" target="_blank">+61 8 9427 2500</a><br>
                    Mobile: <a href="tel:%2B61%20404%20796%20894" value="+61404796894" target="_blank">+61 404 796 894</a><br>
                  </font></font>
                <div><font color="#999999" face="&#39;times new roman&#39;,
                    serif"><br>
                  </font>
                  <div><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>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div>
</div>