Rhel6-cacti+nagios+ganglia(nginx)配置文档

(lnmp平台)

系统环境: rhel6 x86_64 iptables and selinux disabled

主机: 192.168.122.185 server85.example.com

192.168.122.117 server17.example.com (注:时间需同步)

相关网址: rpm.pbone.net http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/ cacti.net nagios.org https://trac.assembla.com/npc(需FQ)


所需的包:cacti-0.8.7h.tar.gz cacti-spine-0.8.7h.tar.gz cacti-plugin-0.8.7h-PA-v3.0.tar.gz settings-v0.71-1.tgz monitor-v1.3-1.tgz nagios-cn-3.2.3.tar.bz2 nagios-plugins-1.4.16.tar.gz gd-devel-2.0.35-10.el6.x86_64.rpm FCGI-0.74.tar.gz FCsettings-v0.71-1.tgzGI-ProcManager-0.24.tar.gz ExtUtils-Constant-0.23.tar.gz Socket-2.001.tar.gz fastcgi-wrapper.pl rrdtool-perl-1.3.8-6.el6.x86_64.rpm fetion linuxso_20101113.tar.gz nrpe-2.14.tar.gz ganglia-3.4.0.tar.gz ganglia-web-3.5.2.tar.gz libconfuse-2.6-3.el6.x86_64.rpm libconfuse-devel-2.6-3.el6.x86_64.rpm rrdtool-devel-1.3.8-6.el6.x86_64.rpm npc-2.0.4.tar.gz ndoutils-1.4b9.tar.gz PDO_MYSQL-1.0.2.tgz


1.安装与配置cacti

 

[root@server17 kernel]# tar zxf cacti-0.8.7h.tar.gz -C /usr/local/lnmp/nginx/html/

[root@server17 kernel]# cd /usr/local/lnmp/nginx/html/

[root@server17 html]# mv cacti-0.8.7h/ cacti

[root@server17 cacti]# yum install rrdtool -y

[root@server17 cacti]# vim /usr/local/lnmp/nginx/conf/nginx.conf

location ~ \.php$ {

root html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

include fastcgi.conf;

}

[root@server17 cacti]# nginx -s reload

[root@server17 cacti]# /etc/init.d/mysqld start

[root@server17 cacti]# /etc/init.d/php-fpm start

[root@server17 cacti]# mysql

mysql> create database cacti;

mysql> quit

[root@server17 cacti]# mysql cacti < cacti.sql

[root@server17 cacti]# mysql

mysql> grant all on cacti.* to cacti@localhost identified by 'cacti';

mysql> flush privileges;

mysql> quit

[root@server17 cacti]# cd /usr/local/lnmp/nginx/html/cacti/include/

[root@server17 include]# vim config.php

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cacti";

$database_password = "cacti";

$database_port = "3306";

$database_ssl = false;

[root@server17 include]# nginx -s reload

访问server17.example.com/cacti出现如下页面:

解决方法如下:

[root@server17 include]# yum list net-snmp*

[root@server17 include]# yum install net-snmp.x86_64 net-snmp-utils.x86_64 net-snmp-perl.x86_64 net-snmp-python.x86_64 -y

按下一步会出现白屏,解决方法如下:

[root@server17 include]# vim /usr/local/lnmp/nginx/html/cacti/lib/functions.php

function kill_session_var($var_name) {

/* register_global = off: reset local settings cache so the user sees the new settings */

unset($_session_unregister[$var_name]);


/* register_global = on: reset local settings cache so the user sees the new settings */

unset($_SESSION[$var_name]);

}

[root@server17 include]# useradd cacti

[root@server17 include]# chown cacti /usr/local/lnmp/nginx/html/cacti/rra/ -R

[root@server17 include]# chown cacti /usr/local/lnmp/nginx/html/cacti/log/ -R

[root@server17 include]# su - cacti

[cacti@server17 ~]$ crontab -e

*/5 * * * * /usr/local/lnmp/php/bin/php /usr/local/lnmp/nginx/html/cacti/poller.php

[cacti@server17 etc]$ logout

[root@server17 include]# /etc/init.d/crond start

[root@server17 include]# vim /etc/snmp/snmpd.conf

(:以下配置可在http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/上查看)

#com2sec notConfigUser default public

com2sec local localhost public

com2sec mynetwork 192.168.122.0/24 public

#group notConfigGroup v1 notConfigUser

#group notConfigGroup v2c notConfigUser

group MyRWGroup v1 local

group MyRWGroup v2c local

group MyRWGroup usm local

group MyROGroup v1 mynetwork

group MyROGroup v2c mynetwork

group MyROGroup usm mynetwork

view systemview included .1.3.6.1.2.1

view systemview included .1.3.6.1.2.1.25.1.1

view all included .1 80

#access notConfigGroup "" any noauth exact systemview none none

access MyROGroup "" any noauth exact all none none

access MyRWGroup "" any noauth exact all all none

syslocation rhel6.3 (edit /etc/snmp/snmpd.conf)

syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)

[root@server17 include]# /etc/init.d/snmpd start

[root@server17 include]# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex (此命令可在http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/上查看)

IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1

IP-MIB::ipAdEntIfIndex.192.168.122.117 = INTEGER: 2

(出现类似上面的输出为正常)

访问server17.example.com/cacti出现如下页面:

:第一次登录会强制要求更改密码(初始用户名:admin,密码:admin)

出现类似上面图形说明可以正常采集到数据.

 

 

 

#安装插件

 

[root@server17 kernel]# tar zxf cacti-plugin-0.8.7h-PA-v3.0.tar.gz

 

[root@server17 kernel]# cd cacti-plugin-arch/

 

[root@server17 cacti-plugin-arch]# mysql cacti < pa.sql

 

[root@server17 cacti-plugin-arch]# cp cacti-plugin-0.8.7h-PA-v3.0.diff /usr/local/lnmp/nginx/html/cacti/

 

[root@server17 cacti]# yum install patch -y

 

[root@server17 cacti]# patch -p1 -N < cacti-plugin-0.8.7h-PA-v3.0.diff

 

[root@server17 cacti]# cd include/

 

[root@server17 include]# vim config.php

 

$cacti_session_name = "Cacti";

 

$url_path = "/cacti/";

 

[root@server17 kernel]# tar zxf settings-v0.71-1.tgz -C /usr/local/lnmp/nginx/html/cacti/plugins

 

[root@server17 kernel]# tar zxf monitor-v1.3-1.tgz -C /usr/local/lnmp/nginx/html/cacti/plugins

选择User Management

 

Plugin Management打上对勾,save保存.

Configuration中就会出现Plugin Management这个选项,启动插件.

注:在新版的cacti中已经集成了Plugin Management这个功能,只需将要安装的插件包加压到cacti目录下的plugins目录中,然后在Plugin Management中安装激活即可使用

 

 

 

#安装并配置spine

 

[root@server17 ~]# yum install net-snmp-devel mysql-devel openssl-devel dos2unix autoconf automake binutils libtool gcc cpp glibc-headers kernel-headers glibc-devel -y

 

[root@server17 kernel]# tar zxf cacti-spine-0.8.7h.tar.gz

 

[root@server17 kernel]# cd cacti-spine-0.8.7h

 

[root@server17 cacti-spine-0.8.7h]# ./bootstrap

 

[root@server17 cacti-spine-0.8.7h]# ./configure --with-snmp=/usr/ --with-mysql=/usr/local/lnmp/mysql/

 

[root@server17 cacti-spine-0.8.7h]# make && make install

 

[root@server17 cacti-spine-0.8.7h]# cd /usr/local/spine/etc/

 

[root@server17 etc]# cp spine.conf.dist /etc/spine.conf

 

[root@server17 etc]# vim /etc/spine.conf

 

DB_Host localhost

 

DB_Database cacti

 

DB_User cacti

 

DB_Pass cacti

 

DB_Port 3306

 

DB_PreG 1

 

(:如果你用的是cacti087g,DB_PreG配置为0,否则将 DB_PreG配置为1.)

 

[root@server17 etc]# /usr/local/spine/bin/spine

 

此时会出现以下错误:

 

/usr/local/spine/bin/spine: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

 

 

 

解决方法如下:

 

[root@server17 etc]# vim /etc/ld.so.conf

 

include ld.so.conf.d/*.conf

 

/usr/local/lnmp/mysql/lib

 

[root@server17 etc]# ldconfig

 

 

 

执行/usr/local/spine/bin/spine出现类似如下结果为正确:

 

SPINE: Using spine config file [/etc/spine.conf]

 

SPINE: Version 0.8.7h starting

 

SPINE: Time: 0.1010 s, Threads: 5, Hosts: 2

选择Settings选项.

选择Paths选项.

如图填写并保存,然后选择Poller选项.

如图选择并保存.

注:观察图像,如果没有出现中断说明spine配置成功.

 

 

 

#监控远程主机(server85.example.com)

 

以下步骤在server85上实施:

 

[root@server85 ~]# yum install net-snmp-5.5-41.el6.x86_64 -y

 

[root@server85 ~]# yum install net-snmp-utils-5.5-41.el6.x86_64 -y

 

[root@server85 ~]# vim /etc/snmp/snmpd.conf

 

(:以下配置可在http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/上查看)

 

#com2sec notConfigUser default public

 

com2sec local localhost public

 

com2sec mynetwork 192.168.122.0/24 public

 

#group notConfigGroup v1 notConfigUser

 

#group notConfigGroup v2c notConfigUser

 

group MyRWGroup v1 local

 

group MyRWGroup v2c local

 

group MyRWGroup usm local

 

group MyROGroup v1 mynetwork

 

group MyROGroup v2c mynetwork

 

group MyROGroup usm mynetwork

 

view systemview included .1.3.6.1.2.1

 

view systemview included .1.3.6.1.2.1.25.1.1

 

view all included .1 80

 

#access notConfigGroup "" any noauth exact systemview none none

 

access MyROGroup "" any noauth exact all none none

 

access MyRWGroup "" any noauth exact all all none

 

syslocation rhel6.3 (edit /etc/snmp/snmpd.conf)

 

syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)

 

[root@server85 ~]# /etc/init.d/snmpd start

 

[root@server85 ~]# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex(此命令可在http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/上查看)

 

IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1

 

IP-MIB::ipAdEntIfIndex.192.168.122.185 = INTEGER: 2

 

注:出现类似上面输出,说明配置完成.

 

 

 

以下步骤在server17上实施:

 

[root@server17 ~]# yum install net-snmp-5.5-41.el6.x86_64 -y

 

[root@server17 ~]# yum install net-snmp-utils-5.5-41.el6.x86_64 -y

 

[root@server17 ~]# vim /etc/snmp/snmpd.conf

 

(:以下配置可在http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/上查看)

 

#com2sec notConfigUser default public

 

com2sec local localhost public

 

com2sec mynetwork 192.168.122.0/24 public

 

#group notConfigGroup v1 notConfigUser

 

#group notConfigGroup v2c notConfigUser

 

group MyRWGroup v1 local

 

group MyRWGroup v2c local

 

group MyRWGroup usm local

 

group MyROGroup v1 mynetwork

 

group MyROGroup v2c mynetwork

 

group MyROGroup usm mynetwork

 

view systemview included .1.3.6.1.2.1

 

view systemview included .1.3.6.1.2.1.25.1.1

 

view all included .1 80

 

#access notConfigGroup "" any noauth exact systemview none none

 

access MyROGroup "" any noauth exact all none none

 

access MyRWGroup "" any noauth exact all all none

 

syslocation rhel6.3 (edit /etc/snmp/snmpd.conf)

 

syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)

 

[root@server17 ~]# /etc/init.d/snmpd start

 

[root@server17 ~]# snmpwalk -v 1 -c public 192.168.122.185 IP-MIB::ipAdEntIfIndex(此命令可在http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/上查看)

 

IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1

 

IP-MIB::ipAdEntIfIndex.192.168.122.185 = INTEGER: 2

选择Devices选项,并选择add设备.

如上图填写并保存.

注:如果需要监控root分区的剩余空间,需要将/etc/snmp/snmpd.conf中的disk / 1000这一行的注释去掉,这样在创建图时才有相应的选项,否则无法监控。

选择所要创建的图.

将新添加的设备加入到树中.

至此cacti的安装及配置完毕!!!

 

 

 

 

2.安装与配置nagios

 

[root@server17 kernel]# useradd nagios

 

[root@server17 kernel]# usermod -G nagios nginx(注:通过web更改nagios设置时,需要考虑此权限问题,例如:启动服务通知时)

 

[root@server17 kernel]# yum localinstall gd-devel-2.0.35-10.el6.x86_64.rpm -y

 

[root@server17 kernel]# tar jxf nagios-cn-3.2.3.tar.bz2

 

[root@server17 kernel]# cd nagios-cn-3.2.3

 

[root@server17 nagios-cn-3.2.3]# ./configure –enable-embedded-perl

 

此时会出现如下提示:

 

Can't locate ExtUtils/Embed.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).

 

BEGIN failed--compilation aborted.

 

Can't locate ExtUtils/Embed.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).

 

BEGIN failed--compilation aborted.

 

creating base/perlxsi.c

 

Can't locate ExtUtils/Embed.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).

 


 

解决方法如下:

 

[root@server17 nagios-cn-3.2.3]# yum install perl-ExtUtils-Embed -y

 

 

 

[root@server17 nagios-cn-3.2.3]# make all

 

[root@server17 nagios-cn-3.2.3]# make install

 

[root@server17 nagios-cn-3.2.3]# make install-init

 

[root@server17 nagios-cn-3.2.3]# make install-commandmode

 

[root@server17 nagios-cn-3.2.3]# make install-config

 

 

 

[root@server17 kernel]# tar zxf nagios-plugins-1.4.16.tar.gz

 

[root@server17 kernel]# cd nagios-plugins-1.4.16

 

[root@server17 nagios-plugins-1.4.16]# yum install openssl-devel -y

 

[root@server17 nagios-plugins-1.4.16]# ./configure --enable-extra-opts --enable-perl-modules --enable-libtap --with-nagios-user=nagios --with-nagios-group=nagios

 

[root@server17 nagios-plugins-1.4.16]# make && make install

 

[root@server17 nagios-plugins-1.4.16]# chown nagios.nagios /usr/local/nagios/ -R

 

[root@server17 nagios-plugins-1.4.16]# /etc/init.d/nagios start

 

 

 

#安装perl fcgi模块

 

FCGI-0.74.tar.gz

 

[root@server17 kernel]# tar zxf FCGI-0.74.tar.gz

 

[root@server17 kernel]# cd FCGI-0.74

 

[root@server17 FCGI-0.74]# perl Makefile.PL

 

[root@server17 FCGI-0.74]# make && make install

 


 

FCGI-ProcManager-0.24.tar.gz

 

[root@server17 kernel]# tar zxf FCGI-ProcManager-0.24.tar.gz

 

[root@server17 kernel]# cd FCGI-ProcManager-0.24

 

[root@server17 FCGI-ProcManager-0.24]# perl Makefile.PL

 

[root@server17 FCGI-ProcManager-0.24]# make && make install

 


 

[root@server17 kernel]# yum install perl-ExtUtils-CBuilder.x86_64 -y

 


 

ExtUtils-Constant-0.23.tar.gz

 

[root@server17 kernel]# tar zxf ExtUtils-Constant-0.23.tar.gz

 

[root@server17 kernel]# cd ExtUtils-Constant-0.23

 

[root@server17 ExtUtils-Constant-0.23]# perl Makefile.PL

 

[root@server17 ExtUtils-Constant-0.23]# make && make install

 


 

Socket-2.001.tar.gz

 

[root@server17 kernel]# tar zxf Socket-2.001.tar.gz

 

[root@server17 kernel]# cd Socket-2.001

 

[root@server17 Socket-2.001]# perl Makefile.PL

 

[root@server17 Socket-2.001]# make && make install

 


 

#启动perl fcgi

 

[root@server17 kernel]# mv fastcgi-wrapper.pl /usr/bin/

 

[root@server17 kernel]# chmod +x /usr/bin/fastcgi-wrapper.pl

 

[root@server17 kernel]# fastcgi-wrapper.pl

 

[root@server17 kernel]# netstat -antple | grep 8999

 

tcp 0 0 127.0.0.1:8999 0.0.0.0:* LISTEN 0 49676 26855/perl

 

:能查看到8999端口说明perl fcgi启动成功.

 


 

#配置nginx发布nagios监控页面

 

[root@server17 kernel]# vim /usr/local/lnmp/nginx/conf/nginx.conf

 

server {

 

 

 

listen 80;

 

charset utf-8; #默认字符集,解决页面乱码

 

server_name nagios.westos.org;

 

root /usr/local/nagios/share;

 

index index.php index.html;

 

auth_basic "nagios access"; #nagios认证

 

auth_basic_user_file /usr/local/nagios/etc/htpasswd.users;

 


 

location /nagios {

 

alias /usr/local/nagios/share;

 

}

 


 

location ~ \.php$ {

 

fastcgi_pass 127.0.0.1:9000;

 

include fastcgi.conf;

 

}

 


 

location ~ ^/nagios/cgi-bin/ {

 

root /usr/local/nagios/sbin/;

 

rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;

 

include fastcgi.conf;

 

fastcgi_param AUTH_USER $remote_user; #nagios认证

 

fastcgi_param REMOTE_USER $remote_user;

 

fastcgi_pass 127.0.0.1:8999;

 

}

 

}

 

[root@server17 kernel]# yum install httpd-tools -y

 

[root@server17 kernel]# htpasswd -m /usr/local/nagios/etc/htpasswd.users nagiosadmin (修改nagiosadmin密码)

 

[root@server17 kernel]# nginx -s reload

 

 

 

访问nagios.westos.org并登录(用户名为nagiosadmin,出现如下页面为成功.(注:记得IP和域名的解析)

此时如果访问拓扑图在终端中会出现以下报错:

/usr/local/nagios/sbin/statusmap.cgi: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

 

 

 

解决方法如下:

 

[root@server17 kernel]# vim /etc/ld.so.conf

 

include ld.so.conf.d/*.conf

 

/usr/local/lnmp/mysql/lib

 

/usr/local/lib64

 

[root@server17 kernel]# ldconfig

 

[root@server17 kernel]# yum localinstall rrdtool-perl-1.3.8-6.el6.x86_64.rpm -y

 


 

[root@server17 kernel]# yum install cjkuni-uming-fonts -y #中文字体

 

 

 


 

#配置nagios监控本机

 

[root@server17 ~]# cd /usr/local/nagios/etc/

 

[root@server17 etc]# vim nagios.cfg

 

#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

 

cfg_file=/usr/local/nagios/etc/objects/hosts.cfg

 

cfg_file=/usr/local/nagios/etc/objects/services.cfg

 

[root@server17 etc]# cd objects/

 

[root@server17 objects]# cp -p localhost.cfg hosts.cfg

 

[root@server17 objects]# vim hosts.cfg

 

define host{

 

use linux-server

 

host_name server17.example.com

 

alias Nagios server

 

address 192.168.122.117

 

icon_image switch.gif

 

statusmap_image switch.gd2

 

2d_coords 100,200

 

3d_coords 100,200,100

 

}

 

define hostgroup{

 

hostgroup_name linux-servers ;

 

alias Linux Servers ;

 

members * ;

 

}

 

[root@server17 objects]# cp -p localhost.cfg services.cfg

 

[root@server17 objects]# vim services.cfg

 

define servicegroup{

 

servicegroup_name 系统负荷检查

 

alias 负荷检查

 

members server17.example.com,进程总数,server17.example.com,登录用户数,server17.example.com,根分区,server17.example.com,交换空间利用率

 

}

 

define service{

 

use local-service ;

 

host_name *

 

service_description PING

 

check_command check_ping!100.0,20%!500.0,60%

 

}

 

define service{

 

use local-service ;

 

host_name server17.example.com

 

service_description 根分区

 

check_command check_local_disk!20%!10%!/

 

}

 

define service{

 

use local-service ;

 

host_name server17.example.com

 

service_description 登录用户数

 

check_command check_local_users!20!50

 

}

 

define service{

 

use local-service ;

 

host_name server17.example.com

 

service_description 进程总数

 

check_command check_local_procs!250!400!RSZDT

 

}

 

define service{

 

use local-service ;

 

host_name server17.example.com

 

service_description 系统负荷

 

check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0

 

}

 

define service{

 

use local-service ;

 

host_name server17.example.com

 

service_description 交换空间利用率

 

check_command check_local_swap!20!10

 

}

 

define service{

 

use local-service ;

 

host_name server17.example.com

 

service_description SSH

 

check_command check_tcp!22!1.0!10.0

 

notifications_enabled 0

 

}

 

define service{

 

use local-service ;

 

host_name server17.example.com

 

service_description NGINX

 

check_command check_http

 

notifications_enabled 0

 

}

 

[root@server17 objects]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg(检测配置是否有错误)

 

[root@server17 objects]# /etc/init.d/nagios reload

 

 

 

访问nagios.westos.org:

 

#配置飞信并与nagios整合

[root@server17 kernel]# mv fetion /usr/local/nagios/libexec/

[root@server17 kernel]# chmod +x /usr/local/nagios/libexec/fetion

[root@server17 kernel]# chown nagios.nagios /usr/local/nagios/libexec/fetion

[root@server17 kernel]# tar zxf linuxso_20101113.tar.gz -C /lib

[root@server17 kernel]# su - nagios

[nagios@server17 ~]$ /usr/local/nagios/libexec/fetion

此时会出现如下错误:

(1)/usr/local/nagios/libexec/fetion: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

(2)/usr/local/nagios/libexec/fetion: error while loading shared libraries: libgssapi_krb5.so.2: cannot open shared object file: No such file or directory

(3)/usr/local/nagios/libexec/fetion: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory


解决方法如下:

(1)[root@server17 kernel]# yum install libstdc++.so.6 -y

(2)[root@server17 kernel]# yum install libgssapi_krb5.so.2 -y

(3)[root@server17 kernel]# yum install libz.so.1 -y

:出现以上输出为正常

测试:[nagios@server17 ~]$ /usr/local/nagios/libexec/fetion --mobile=15905986853 --pwd=lmx15905986853 --to=15905986853 --msg-utf8='Good Luck!'

图形验证码跟你的fetion脚本在同一个目录下

[root@server17 ~]# su - nagios

[nagios@server17 ~]$ cd /usr/local/nagios/libexec/

[nagios@server17 libexec]$ vim fetion.sh

/usr/local/nagios/libexec/fetion --mobile=15905986853 --pwd=lmx15905986853 --to="$1" –msg-utf8="$2"

[nagios@server17 libexec]$ chmod +x fetion.sh

 

测试: [nagios@server17 libexec]$ /usr/local/nagios/libexec/fetion.sh 15905986853 "hello world"

 

 

[nagios@server17 libexec]$ cd /usr/local/nagios/etc/objects/

你可能感兴趣的:(ganglia)