Aliyun Code

首页  >   kongjian / tsar

项目语言:None

创建者:kongjian 创建时间:2011年09月29日

如何安装

从github上检出代码:

$git clone  git://github.com/kongjian/tsar.git

$cd tsar

$make

$make install

或者直接从github上下载源码

$wget -O tsar.zip  https://github.com/alibaba/tsar/archive/master.zip

$unzip tsar.zip

$cd tsar

$make

$make install

如何配置tsar

1.配置文件/etc/tsar/tsar.conf

#debug_level(INFO DEBUG WARN ERROR FATAL)
debug_level FATAL
#[module] on/off to enable mod
mod_cpu on
mod_mem on
mod_swap on
mod_tcp on
mod_udp on
mod_traffic on
mod_io on
mod_pcsw on
mod_partition on
mod_tcpx on
mod_load on

#output type:file,nagios,db
output_interface file

#[output_file] original data to store
output_file_path /var/log/tsar.data

#[output_stdio] these mod will be show as using tsar
output_stdio_mod mod_swap,mod_partition,mod_cpu,mod_mem,mod_traffic,mod_load,mod_tcp,mod_udp,mod_tcpx,mod_pcsw,mod_io

#[output_nagios] the alert will be report to nagios server
#output_nagios_mod #mod_swap,mod_partition,mod_cpu,mod_mem,mod_traffic,mod_load,mod_tcp,mod_udp,mod_tcpx,mod_pcsw,mod_io

#[output_db]
#output_db_mod #mod_swap,mod_partition,mod_cpu,mod_mem,mod_traffic,mod_load,mod_tcp,mod_udp,mod_tcpx,mod_pcsw,mod_io
#output_db_addr console2:56677

#support include other mod conf
include /etc/tsar/conf.d/*.conf

debug_level 指定tsar的运行级别,主要用来调试使用

mod_xxx on/off 开启指定模块

out_interface 设置输出类型,支持file,nagios,db

out_stdio_mod 设置用户终端默认显示的模块

output_db_mod 设置哪些模块输出到数据库

output_db_addr 数据库的ip和端口

output_nagios_mod 设置哪些模块输出到nagios

include 支持include配置,主要用来加载用户的自定义模块

2.配置文件/etc/tsar/nagios.conf

#The IP address of the host running the NSCA daemon
server_addr mmdev4.corp.alimama.com
#The port on which the daemon is running - default is 5667
server_port 8086
#The cycle of send alert to nagios
cycle_time 300
#nsca client program
send_nsca_cmd /usr/bin/send_nsca
send_nsca_conf /home/a/conf/amon/send_nsca.conf

#tsar mod alert config file
#threshold [hostname.]servicename.key;w-min;w-max;c-min;cmax;
threshold cpu.util;N;N;N;N;
threshold mem.util;N;N;N;N;
threshold load.load1;N;N;N;N;
threshold load.load5;N;N;N;N;
threshold load.load15;N;N;N;N;
threshold traffic.bytin;N;N;N;N;
threshold traffic.bytout;N;N;N;N;
threshold tcp.retran;N;N;N;N;

这个文件主要是nagios服务器的配置

cycle_time 指定上报的间隔时间,由于tsar每一分钟采集一次,上报时会判断是否符合时间间隔,如设置300的话,则在0,5等整点分钟会上报nagios

threshold 设置某个要报警项的阀值,前面是模块和要监控的具体名称,后面的四个数据代表报警的范围,warn和critical的范围

3./etc/tsar/conf.d/*

这个目录下是用户的自定义模块配置文件

配置基本在用户开发自定义模块时确定,主要包含模块的开启,输出类型和报警范围

附件

kongjian | 2013-04-16 14:53:27 | tsar.tar.gz | 75.0 KB
kongjian | 2011-09-29 23:58:04 | tsar-2.1.0-0.el4.x86_64.rpm | 59.2 KB
kongjian | 2011-09-29 23:58:04 | tsar-devel-2.1.0-0.el4.x86_64.rpm | 4.8 KB
kongjian | 2011-09-29 23:58:04 | liucheng.png | 36.1 KB