{"id":47,"date":"2015-06-11T15:32:59","date_gmt":"2015-06-11T19:32:59","guid":{"rendered":"http:\/\/blog.voipxswitch.com\/?p=47"},"modified":"2015-07-15T14:20:31","modified_gmt":"2015-07-15T18:20:31","slug":"freeswitch-high-call-volume-alert-script","status":"publish","type":"post","link":"https:\/\/blog.voipxswitch.com\/?p=47","title":{"rendered":"FreeSWITCH: High call volume alert script"},"content":{"rendered":"<p>I was tasked to come up with a way to monitor for high call volume in FreeSWITCH. I came up with this here is a simple script that will check the channel count and email me if it&#8217;s greater than $MAX_CALLS<\/p>\n<p>&nbsp;<\/p>\n<pre>#!\/bin\/bash\r\n\r\nMAX_CALLS=100\r\nCHANNEL_COUNT=$(\/usr\/bin\/fs_cli -x \"show channels count\" | awk '\/total\/ {print $1}')\r\n\r\nif [ $CHANNEL_COUNT -gt $MAX_CALLS ]; then\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 # From\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 FROM=\"alert@voipxswitch.com\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 # Subject\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SUBJECT=\"High Call Volume\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 # To\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 TOEMAIL=\"admin@voipxswitch.com\"\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/usr\/bin\/mailx \"-aFrom:$FROM\" -s \"$SUBJECT\" \"$TOEMAIL\"&lt;&lt;END\r\nThis is an email alert to notify you that the server has reached $CHANNEL_COUNT calls.\r\nEND\r\n\r\nfi<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I was tasked to come up with a way to monitor for high call volume in FreeSWITCH. I came up with this here is a simple script that will check the channel count and email me if it&#8217;s greater than $MAX_CALLS &nbsp; #!\/bin\/bash MAX_CALLS=100 CHANNEL_COUNT=$(\/usr\/bin\/fs_cli -x &#8220;show channels count&#8221; | awk &#8216;\/total\/ {print $1}&#8217;) if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,25,15],"tags":[],"class_list":["post-47","post","type-post","status-publish","format-standard","hentry","category-freeswitch","category-sip","category-voip"],"_links":{"self":[{"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/posts\/47","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=47"}],"version-history":[{"count":2,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/posts\/47\/revisions"}],"predecessor-version":[{"id":59,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=\/wp\/v2\/posts\/47\/revisions\/59"}],"wp:attachment":[{"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.voipxswitch.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}