Quantcast
Channel: 钻戒 and 仁豆米
Viewing all articles
Browse latest Browse all 290

Centreon的CLAPI应用

$
0
0

公司的监控系统是Centreon+nagios。

其实无论是nagios或者zabbix,用习惯了用顺了都一样。

如何在命令行给一个主机增加一个服务监控呢?

首先,查查都有什么服务模板:

centreon -uadmin -ppassword  -o STPL -a show  
2549;nrpe_check_http;nrpe_check_http;check_nrpe;!check_http;;;;2;2  

看结果:
1是服务ID,2是服务描述,3是服务命令,4是命令参数,......倒数第2是Active check enable,倒数第1是Passive check enable

我们记住nrpe_check_http

我们查查要添加监控服务的机器:

centreon -uadmin -ppassword -o SERVICE -a show|grep 172.16.9.101  
143;172.16.9.101;1425;nrpe_check_cpu;;;;;;2;2;1  
143;172.16.9.101;1424;nrpe_check_disk;;;;;;2;2;1  
143;172.16.9.101;1430;nrpe_check_io;;;;;;2;2;1  
143;172.16.9.101;1428;nrpe_check_load;;;;;;2;2;1  
143;172.16.9.101;1426;nrpe_check_mem;;;;;;2;2;1  
143;172.16.9.101;1427;nrpe_check_net;;;;;;2;2;1  
143;172.16.9.101;1429;nrpe_check_open_file;;;;;;2;2;1  
143;172.16.9.101;1431;nrpe_check_procs;;;;;;2;2;1  
143;172.16.9.101;1432;nrpe_check_socket;;;;;;2;2;1  
143;172.16.9.101;1433;nrpe_check_uptime;;;;;;2;2;1  
143;172.16.9.101;1423;ping;;;;;;2;2;1  

1是Host ID,2是主机名host name,3是服务id,4是服务描述,......,倒数第3是Active check enable,倒数第2是Passive check enable,倒数第1是服务是否激活。

我们记下来hostname,是1721.6.9.101.

添加:

centreon -uadmin -ppassword -o SERVICE -a add -v "172.16.9.102;nrpe_check_http;nrpe_check_http"  

3个参数,1是主机名hostname,2是服务描述,3是服务的模板service template

ok, 这样就添加好了。

删除的命令如下:

centreon -uadmin -ppassword -o SERVICE -a del -v "172.16.8.1;nrpe_check_bgp2"  

最后到Centreon里,重启nagios服务,就好了。


Viewing all articles
Browse latest Browse all 290

Trending Articles