本帖最后由monicazhang于2015-10-3021:35编辑
20151030淡然
process_performance_data=1//此处修改为1 添加如下行 #
#serviceperformancedata
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdatanagios安装
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
#
#hostperformancedatastartingwithNagios3.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修改最后两行为 definecommand{
command_nameprocess-service-perfdata-file command_line/usr/local/pnp4nagios/libexec/process_perfdata.pl--bulk=/usr/local/pnp4nagios/var/service-perfdata
}
definecommand{ command_nameprocess-host-perfdata-file command_line/usr/local/pnp4nagios/libexec/process_perfdata.pl--bulk=/usr/local/pnp4nagios/var/host- perfdata } cd/usr/local/pnp4nagios/share mvinstall.phpinstall.php.bak ############################################################################ 让nagios显示小太阳图标,在pnp4nagios的源码包下面执行 cpcontrib/ssi/*/usr/local/nagios/share/ssi/ 然后在服务或者主机定义里面添加action_url #vi/usr/local/nagios/etc/objects/templates.cfg definehost{
uselinux-server
host_namelocalhost
aliaslocalhost
address127.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_//添加此行
} defineservice{
uselocal-service;Nameofservicetemplatetouse
host_namelocalhost
service_descriptionPING
check_commandcheck_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界面操作,不用去编辑配置文件 tarzxvfnconf-1.3.0-0.tgz-C/var/www/html/
chown-Rapache.apache/var/www/html/nconf/ 为nconf创建数据库,默认Mysql安装后没有密码,后面要用到密码,这里提前设置一个密码监控软件 mysqladmin-urootpassword"xinqidian" mysql-uroot-p createdatabasenconf; cp/usr/local/nagios/bin/nagios/var/www/html/nconf/bin chownapache.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.phpUPDATE/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
|