diff --git a/bin/riemann-freeswitch b/bin/riemann-freeswitch new file mode 100755 index 00000000..a36b997d --- /dev/null +++ b/bin/riemann-freeswitch @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby + +require File.expand_path('../../lib/riemann/tools', __FILE__) + +class Riemann::Tools::FreeSWITCH + include Riemann::Tools + + def tick + + #determine how many current calls I have according to FreeSWITCH + fs_calls = %x[fs_cli -x "show calls number"| grep -Po '^\d+'] + + #determine how many current channels I have according to FreeSWITCH + fs_channels = %x[fs_cli -x "show channels number"| grep -Po '^\d+'] + + #submit them to riemann + report( + :service => "FreeSWITCH current calls", + :metric => fs_calls.to_i, + :state => "info" + ) + + report( + :service => "FreeSWITCH current channels", + :metric => fs_channels.to_i, + :state => "info" + ) + end +end + +Riemann::Tools::FreeSWITCH.run