最近这几台,几台服务器老挂,,可能是因为太老了,,没办法,只能弄个NAGIOS来监控它
首先安装http,什么都不用说了吧,
wget
tar -zxvf httpd-2.2.9.tar.gz
cd httpd-2.2.9
./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-mods-shared=most
make;make install
cd ..
接下来开始安装nagios
wget
groupadd nagios
groupadd nagcmd
useradd nagios -g nagcmd -d /usr/local/nagios
mkdir -p /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios
chmod 755 /usr/local/nagios
tar -zxvf nagios-3.0.6.tar.gz
cd nagios-3.0.6
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
cd ..
默认安装到/usr/local/nagios目录下
生成一个用户密码:
/usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
配置一下httpd.conf
cd /usr/local/apache/conf
cat >>httpd.conf<ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Alias /nagios "/usr/local/nagios/share"
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
eof
安装nagios换件
wget
tar -zxvf nagios-plugins-1.4.13.tar.gz
cd nagios-plugins-1.4.13
./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-gourp=nagios --enable-perl-modules
make;make install
cd ..
chkconfig --add nagios
service nagios start
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg //检测配置文件
service nagios restart
修改mail
vi /usr/local/nagios/etc/objects/contacts.cfg
增加一个hosts.cfg,内容如下:
[root@localhost objects]# cat hosts.cfg
define host{
use linux-server
host_name nagios-server
alias nagios-server
address 10.88.12.89
max_check_attempts 5
normal_check_interval 3
retry_check_interval 2
check_period 24x7
notification_interval 10
notification_period 24x7
notification_options d,u,r
contact_groups admins
}
define service{
use generic-service
host_name nagios-server
service_description HTTP
check_command check_http
}
define service{
use generic-service
host_name nagios-server
service_description SSH
check_command check_ssh
}
define service{
use local-service
host_name nagios-server
service_description PING
check_command check-host-alive
}
再将cfg_file=/usr/local/nagios/etc/hosts.cfg,加入到nagios.cfg里面
重启服务
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios restart
user:nagiosadmin
pwd:刚才生成的
这样就OK了
nagios访问apache权限问题解决
nagios web界面提示
It appears as though you do not have permission to view information for any of the services you requested...
打开cgi.cfg配置文件,里面有个参数: use_authentication=1 为了保障系统的安全性,nagios设置了这个参数,默认为1,改为0即可
1.
装了几次,换了几个版本的系统,脑袋都大了,终于解决了
nrpe在 ./configure时提示
checking for SSL... configure: error: Cannot find ssl libraries
把openssl-devel装上就可以了
2.
nagios web界面提示
It appears as though you do not have permission to view information for any of the services you requested...
打开cgi.cfg配置文件,里面有个参数: use_authentication=1 为了保障系统的安全性,nagios设置了这个参数,默认为1,改为0即可。 |
3.
Service Commands 中Enable notifications for this service时报错
Sorry Dave, I can't let you do that...
It seems that you have chosen to not use the authentication functionality of the CGIs.
I don't want to be personally responsible for what may happen as a result of allowing unauthorized users to issue commands to Nagios,so you'll have to disable this safeguard if you are really stubborn and want to invite trouble.
Read the section on CGI authentication in the HTML documentation to learn how you can enable authentication and why you should want to.
修改cgi.cfg文件
修改use_authentication=1 (默认) ,如果没有添加,重启nagios服务。
4.
is not allowed to connect to this MySQL server
server(nagios服务端192.168.0.132) #/usr/local/nagios/libexec/check_mysql -H 192.168.0.207 -u root -p xukixu 此时可能会出现错误:Host '192.168.0.132' is not allowed to connect to this MySQL server
因此只要在客户端做个mysql授权用户访问即可 2、client(客户端192.168.0.207) #mysql -uroot -pabcd mysql>grant all privileges on *.* to identified by 'abcd; mysql>flush privileges; mysql>quit;
|
阅读(1377) | 评论(0) | 转发(0) |