<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Nice, if it's ok with you I'm going to 'borrow' this and make it
    work with Cactus<br>
    <br>
    - John<br>
    <br>
    <div class="moz-cite-prefix">On 17/05/13 3:24 PM, Alex Ynema wrote:<br>
    </div>
    <blockquote
cite="mid:CAN-21F5D9VhqygfgdCdFACgYrMFF3pER3okffheDShjPnMzQaQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">I thought I'd post this for people reference. I'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=" "</div>
            <div>/usr/local/freeswitch/bin/fs_cli -x "show calls count"
              &gt; /tmp/fsStatus</div>
            <div>if [ $? -ne 0 ]; then</div>
            <div>&nbsp; &nbsp; &nbsp; &nbsp; echo "Critical: Freeswitch not responding!"</div>
            <div>&nbsp; &nbsp; &nbsp; &nbsp; rm /tmp/fsStatus</div>
            <div>&nbsp; &nbsp; &nbsp; &nbsp; exit -1</div>
            <div>fi</div>
            <div><br>
            </div>
            <div>fsCalls=`grep "total."&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="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># &nbsp; ouput:Active Sessions: 0</div>
            <div>/output:Active.*?(\d+)/</div>
            <div>and push @s, [ "session",</div>
            <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ "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>&nbsp;</b>|&nbsp;</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 moz-do-not-send="true"
                            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><font color="#999999" face="'times new roman',
                    serif"><br>
                  </font>
                  <div><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 moz-do-not-send="true"
                            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 class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a class="moz-txt-link-abbreviated" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a class="moz-txt-link-freetext" href="http://www.cudatel.com">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>