中国VoIP网论坛

现在的时间是 2010-09-10, 2:48

当前时区为 UTC + 8 小时




发表新帖 回复这个主题  [ 2 篇帖子 ] 
作者 内容
 文章标题 : nagios => check if freeswitch active
帖子发表于 : 2010-01-21, 11:12 
离线
高级
头像

注册: 2007-07-13, 1:07
帖子: 126
#!/usr/bin/perl

use RPC::XML::Client;
use Data::Dumper;
use Getopt::Std;

sub usage {
print "Usage: $0\n\n";
print "\t -H \t Hostaddress \t\t\t\t (required)\n";
exit(1);
}

sub warning {
print "@_\n";
exit(1);
}

sub critical {
print "@_\n";
exit(2);
}

sub unknown {
print "@_\n";
exit(3);
}

sub success {
print "@_\n";
exit(0);
}

my %opts;

getopts('H:', \%opts);

my $host = $opts{"H"};

if (length($host) > 0) {

         my $client = new RPC::XML::Client('http://'.$host.':8080/RPC2');
         my $req = RPC::XML::request->new('freeswitch.api',
                                                        'show',
                                                         'channels');

         $client->credentials ("freeswitch" , "freeswitch", "works");

         $res = $client->send_request($req);

         my $value = $res->value;
         chomp($value);

         $total = 0;

         if ($value =~ m/(\d+) total\./) {
                     $total = $1;                    
         }

         if ($total == 0) {
                     critical("FreeSwitch OK: Channel = [".$total."]");
         } else {
                     success("FreeSwitch OK: Channel = [".$total."]");
         }
} else {
         usage();
}


============================================

./check_freeswitch_alive.pl -H hostname

如果 channel 的数目等于 0, 认为 freeswitch 的连接有问题。
否则,认为正常。

==============================================


页首
 用户资料  
 
 文章标题 : Re: nagios => check if freeswitch active
帖子发表于 : 2010-01-26, 5:53 
离线
高级
头像

注册: 2007-07-13, 1:07
帖子: 126
freeswitch 配置文件


1. modules.conf.xml, uncomment "<load module="mod_xml_rpc"/>"

2. xml_rpc.conf.xml,    <param name="auth-pass" value="works"/>


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 2 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 0 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

查找:
前往 :  
cron
Powered by phpBB © 2000, 2002, wu, 2005, 2007 phpBB Group
简体中文语系由 PHPBB中文翻译小组 维护制作

phpBB PHPBB Hacks PHPBB Styles Nederlandstalige phpBB Support phpbbw4c phpbbegypt.com cnphpbb.com cooldtp.cn singapuraforum SubLet.cn Zen-Cart phpBB China
[BambooCat Planet] [OurPlus] [MySnooker]