Debian系统如何集成Nagios+Centreon+Nrpe
来自:网络Debian 系统 Nagios+Centreon+Nrpe集成 1、软件包信息
操作系统
debian-6.0.5-amd64-DVD-1
Centreon
centreon-2.3.9.tar.gz
Nagios
nagios-3.4.1.tar.gz
源码安装
Nagios插件
nagios-plugins-1.4.16.tar.gz
Ndoutils
ndoutils-1.5.2.tar.gz
Nrpe
nrpe-2.13.tar.gz
MySQL
mysql-5.5.15.tar.gz
2、服务端在线安装内容
Program groups
Command
System base
apt-get install sudo tofrodos bsd-mailx lsb-release heirloom-mailx build-essential
Database server
apt-get install mysql-server libmysqlclient16 libmysqlclient-dev libmysql++-dev
###备注:这是在线安装内容,红色字体内容是源码安装mysql5.5.15后也需要安装的内容
WebServer and
PHP5
apt-get install apache2 apache2-mpm-prefork php5 php5-mysql php-pear php5-ldap php5-snmp php5-gd
RRDTools
apt-get install rrdtool librrds-perl
### 备注:安装后路径:/usr/bin/rrdtool
Perl modules
apt-get install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl
SNMP
apt-get install snmp snmpd libnet-snmp-perl libsnmp-perl
GD-libraries
and othes pack
apt-get install libgd2-xpm libgd2-xpm-dev libpng12-dev fping libmcrypt4 libldap2-dev libgnutls-dev libssl-dev smbclient libpq-dev libradiusclient-ng-dev dbi-link
3、服务端集成应用 3.1 Mysql 源码安装省略……# insserv mysqld //创建自启动# insserv -d mysqld# mysqladmin -u root password '111111' //修改root密码3.2 Ngigos 3.2.1安装### 版本:nagios-3.4.1.tar.gz下载地址:http://www. /download/ nagios培训 //问题解决: 问题(1)./installdb nagios数据库时报:failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at ./installdb line 41解决:# mkdir -p /var/run/mysqld# ln -s /tmp/mysql.sock /var/run/mysqld/mysqld.sock问题(2)./installdb nagios数据库时报:DBD::mysql::db do failed: Table 'nagios.nagios_dbversion' doesn't exist at ./installdb line 51.解决:可以忽略,核实nagios数据库59个表即可问题(3)tail -fnagios.log时,提示:ndomod: Could not open data sink!或ndomod: Still unable to connect to data sink.解决:按照以上操作,且进程ps均可见,则尝试重启ndo2db 或nagios或mysql4、centreon集成4.1应用程序安装### 版本:centreon-2.3.9.tar.gz下载地址:Content-Download/donwload-centreon安装参考文档:(1)01-centreon/centreon_web/documentation/01-setup/installation_from_sources/step_05_-_centreon(2)s/blog_5611597901016qd2.html # tar zxvf centreon-2.3.9.tar.gz# cd centreon-2.3.9# ./install.sh -i //以下是安装过程中需要根据实际路径修改的地方,其他均为y 回车(当然你也可以自己定制)Where is your NDO ndomod binary ?
default to
> /usr/local/nagios/bin/ndomod.o
/usr/local/nagios/bin/ndomod.o OK
4.2 web installation (1)以下服务均已启动 # /etc/init.d/apache2 start# /etc/init.d/mysqld start# /etc/init.d/ndo2db start# /etc/init.d/nagios start(2)开始安装:http://192.168.113.5/centreon/
### 备注参考内容:
01-centreon/centreon_web/documentation/01-setup/installation_from_sources/step_05_-_centreon
s/blog_5611597901016qd2.html
### 部分配图:其他基本next
图示1:mysql root密码填写,三个新库密码设置 nagios实施
uploads/img/201407/01230215_zfoY.jpg
图示2:配置centreon管理员用户、密码、其他三项自定义
uploads/img/201407/01230215_t6Tu.jpg
4.3在线安装nagios后 Centreon安装时,其他应用在线安装的,需要修改以下可能出现的路径问题: 监控软件
Where is installed Nagios ?
default to
>/usr/share/nagios3/
Patusr/share/nagios3/ OK
Where is your nagios config directory
default to
> /etc/nagios3
Patetc/nagios3 OK
Where is your Nagios var directory ?
default to
>/var/log/nagios3/
Patvar/log/nagios3/ OK
Where is your Nagios plugins (libexec) directory ?
default to
> /usr/lib64/nagios/plugins
Patusr/lib64/nagios/plugins OK
/usr/sbin/nagios3 OK
Where is your Nagios image directory ?
default to
> /usr/share/nagios3/htdocs/images/logos/
Patusr/share/nagios3/htdocs/images/logos/ OK
Where is your NDO ndomod binary ?
default to
> /usr/lib/ndoutils/ndomod-mysql-3x.o
/usr/lib/ndoutils/ndomod-mysql-3x.o OK
4.4 Web 安装centreon完成后### 参考链接:[/?page_id=968]?page_id=968 nagios配置 Finalize Centreon configuration:
Open in webrowser: "http://<yourserverip>/centreon/", replace "<yourserverip>" with your Centreon server ip address or hostname.
Go to: Configuration -> Nagios -> cgi (in sidebar), Press on "CGI.cfg" link
Change settings to some options, as writed below:
- Physical HTML Path: /usr/share/nagios3/htdocs
- URL HTML Path : /nagios3
- Nagios Process Check Command: /usr/lib/nagios/plugins/check_nagios /var/cache/nagios3/status.dat 5 '/usr/sbin/nagios3'
Press Save
Go to: Configuration -> Nagios -> nagios.cfg (in sidebar), Press on "Nagios CFG 1" link, you should be in "Files" section of the configuration screen.
Make sure to set folowing configuration values:
- Log File : /var/log/nagios3/nagios.log
- Downtime File : /var/lib/nagios3/downtime.dat
- Comment File : /var/lib/nagios3/comment.dat
- Temp File : /var/cache/nagios3/nagios.tmp
- P1 File : /usr/lib/nagios3/p1.pl
- Lock File : /var/run/nagios3/nagios3.pid
- Object Cache File : /var/cache/nagios3/objects.cache
- Status File : /var/cache/nagios3/status.dat
- External Command File : /var/lib/nagios3/rw/nagios.cmd
Now Press on "Logs Options" tab to go to "Logs Options" section. 开源监控软件 Make sure to set folowing configuration values:
- Log Archive Path : /var/log/nagios3/archives/
- State Retention File : /var/lib/nagios3/retention.dat
Press Save
Go to: Administration -> Options -> CentStorage (in sidebar)
Make sure to set folowing configuration values:
- Nagios current log file to parse: /var/log/nagios3/nagios.log
Press Save
Now let's apply our changes, go to: Configuration -> Nagios
Select as below:
- Generate Configuration Files
- Include Comments
- Run Nagios debug (-v)
- Move Export Files
- Restart Nagios
- Method: "External Command"
Press Export
This will restart Nagios & apply all changes you made in Web Interface.
You will do it every time you make changes, e.g. adding/modifying of hosts, commands, contacts, services...etc... nagios安装
The installation of Centreon is completed.
Final fixes (very important):
Go to terminal console, then...
In Debian/Ubuntu the user "nagios" is set to "/bin/false" shell. Because of it "centcore" and "centstorage" daemons won't start. A reason for that is because those daemons use "su -c" command which requires a real shell, so the shell for
"nagios" user must be set to "/bin/sh":
# usermod -s /bin/sh nagios
Apply permissions for Web interface to be able to send "External Commands", perform the following commands to change directory permissions and to make the changes permanent:
# invoke-rc.d nagios3 stop
# dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
# dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
Add htaccess user with password "P@ssw0rd" for nagios CGI:
# htpasswd -bc /etc/nagios3/htpasswd.users nagiosadmin P@ssw0rd
Allow SNMP readonly access:
# echo "rocommunity public" > /etc/snmp/snmpd.conf
If you want to allow SNMP access only for localhost then use this instead:
# echo "rocommunity public 127.0.0.1" > /etc/snmp/snmpd.conf
# ls -al /usr/lib/nagios/plugins//查看权限,需要具有sudo权限
# cd /usr/lib/nagios/
# chmod -R u+s plugins //权限修改成 :-rwsr-xr-x
### 不修改权限会报:Warning: This plugin must be either run as root or setuid root.
Now, restart the server
# reboot
4.5 可能的报错信息(1)报错解决:
Error: Could not create external command file '/var/log/nagios3/rw/nagios.cmd'
解决:mkdir /var/log/nagios3/rw
Chown nagios.nagios rw
(2)在线安装ndoutils,启动ndo2前一定要修改:/etc/default/ndoutils
ENABLE_NDOUTILS=1
想做Nagios, Zabbix,Cacti,iTop各种交流的,可以进入开源监控工具Nagios交流QQ群号 :476809427
页:
[1]