本帖最后由 monicazhang 于 2015-10-30 21:35 编辑
20151030淡然
process_performance_data=1 //此处修改为1 添加如下行 #
# service performance data
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata nagios安装
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC:: $SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE:: $HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# host performance data starting with Nagios 3.0
#
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA:: 1. $HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$ 2. host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file 开源监控软件 vi /usr/local/nagios/etc/objects/commands.cfg 修改最后两行为 define command{
command_name process-service-perfdata-file command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/service-perfdata
}
define command{ command_name process-host-perfdata-file command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/host- perfdata } cd /usr/local/pnp4nagios/share mv install.php install.php.bak ############################################################################ 让nagios显示小太阳图标,在pnp4nagios的源码包下面执行 cp contrib/ssi/* /usr/local/nagios/share/ssi/ 然后在服务或者主机定义里面添加action_url #vi /usr/local/nagios/etc/objects/templates.cfg define host{
use linux-server
host_name localhost
alias localhost
address 127.0.0.1
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' nagios配置 rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_ //添加此行
} define service{
use local-service ; Name of service template to use
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$ //添加此行
} 此时在web界面的ping旁边会显示一个小的图标,把鼠标放上去会放大 ########################################################################################################
安装nconf 安装nconf实现nagios的图形化配置,可以直接在web界面操作,不用去编辑配置文件 tar zxvf nconf-1.3.0-0.tgz -C /var/www/html/
chown -R apache.apache /var/www/html/nconf/ 为nconf创建数据库,默认Mysql安装后没有密码,后面要用到密码,这里提前设置一个密码 监控软件 mysqladmin -u root password "xinqidian" mysql -u root -p create database nconf; grant all privileges on nconf.* to 'nconf'@localhost identified by 'nconf' with grant option; cp /usr/local/nagios/bin/nagios /var/www/html/nconf/bin chown apache.nagios /var/www/html/nconf/bin/nagios 修改php配置文件,确认mysql正确加载,追加以下内容: vi /etc/php.ini extension=mysql.so extension=mysqli.so extension=pdo_mysql.so 按照提示安装,并输入上面创建的数据库和用户及密码 nagios实施 根据提示进行安装 然后删除/var/www/html/nconf/下面的 INSTALL/ INSTALL.php UPDATE/ UPDATE.php重新刷新页面就可以 使用了! 如果用WEB配置时提示mysql、nconf错误时,可手工设置/var/www/html/nconf/config下的mysql.php与nconf.php文件 把mysql.php里的相应相应项做更改,如: define('DBHOST', "localhost");
define('DBNAME', "nconf");
define('DBUSER', "nconf");
define('DBPASS', "nconf");
nconf.php文件: define('NCONFDIR', "/var/www/html/nconf"); define('NAGIOS_BIN', "/var/www/html/nconf/bin/nagios"); 可选配置 如要做Nconf认证,使用file认证类型 //web配置时如果使用认证才可以配置,那么先按照如下配置再进行 修改/var/www/html/nconf/config/authentication.php如下: nagios培训 define('AUTH_ENABLED', '1'); 此时默认帐号是admin,密码nconf,具体可见/var/www/html/nconf/include/login_check.php
|