符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
1、最小化安装Centos系统。
配置网络地址使其可以上网。
2、安装setup工具
yum -y install setuptool ntsysv iptables system-config-securitylevel-tui system-config-network-tui system-config-firewall-tui make vim
3、修改显示语言
[root@localhost ~]# more /etc/sysconfig/i18n
#LANG=”zh_CN.UTF-8″
LANG=”zh_CN.GB18030″
SYSFONT=”latarcyrheb-sun16″
4、安装依赖包。
[root@KING ~]# yum -y install gcc glibc glibc-common gd gd-devel httpd
5、添加相应用户及组
[root@KING conf]# groupadd nagcmd
[root@KING conf]# useradd -G nagcmd nagios
[root@KING conf]# useradd -G nagcmd apache
6、正式安装nagios
#tar zxf nagios-3.4.1.tar.gz
#cd nagios
#./configure –prefix=/usr/local/nagios –with-command-group=nagcmd
#make all
#make install
#make install-init
#make install-config
#make install-commandmode
#make install-webconf
#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
7、编译安装nagios插件
#tar zvxf nagios-plugins-1.4.15.tar.gz
#cd nagios-plugins-1.4.15
#./configure –prefix=/usr/local/nagios –with-nagios-user=nagios –with-nagios-group=nagios
#make && make install
#chkconfig –add nagios
#chkconfig nagios on
#chkconfig httpd on
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
#service nagios start
创新互联建站专注于巨鹿网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供巨鹿营销型网站建设,巨鹿网站制作、巨鹿网页设计、巨鹿网站官网定制、微信平台小程序开发服务,打造巨鹿网络公司原创品牌,更为您提供巨鹿网站排名全网营销落地服务。
#vim /root/.bashrc
#添加一条alias check=’/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg’
#source /root/.bashrc
8、安装后常见问题解决
问题1打开http://192.168.5.64/nagios输入口令验证后出现“You don’t have permission to access /nagios/ on this server”
解决方法没装php导致yum -y install php装好重启httpd和nagios
问题2如果提示“Whoops! Error: Could not read object configuration data! ”这是因为没有启动nagios后台进程执行以下命令
解决方法/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
问题3Nagios显示类似错误HTTP WARNING: HTTP/1.1 403 Forbidden – 5240 bytes in 0.002 second response time。该错误表明在apache web根目录没有index.html文件。
解决方法在web根目录如:/var/www/html/目录建立index.html文件重启apache和nagios即可。
问题4安装nagios-pluginsmake时出现如下报错
make[2]: *** [check_http.o] Error 1
make[2]: Leaving directory `/mnt/nagios-plugins-1.4.13/plugins’
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/mnt/nagios-plugins-1.4.13′
make: *** [all] Error 2
解决办法yum -y install openssl openssl-devel然后重新执行./configure再编译安装。
9、设置nagios.cmd写权限
chmod 777 /usr/local/nagios/var/rw/nagios.cmd
10、安装nrpe客户端
首先安装SSL支持包[root@KING conf.d]# yum -y install openssl openssl-devel xinetd
安装nrpe[root@KING nagios]# tar -zvxf nrpe-2.12.tar.gz
#cd nrpe-2.12
#./configure
#make all
#make install-plugin
#make install-daemon
#make install-daemon-config
#make install-xinetd
vim /etc/xinetd.d/nrpe
only_from = 192.168.5.57
vim /etc/services
添加nrpe 5666/tcp #NRPE
重启xinetd服务。
测试下连通性在监控端执行
/usr/local/nagios/libexec/check_nrpe -H 被监控端的地址
如能显示 “NRPE v2.12”表明NRPE可以和被监控端正常通信。
被监控端安装nrpe
同监控端额外安装插件
useradd -s /sbin/nologin nagios
#tar xzf nagios-plugins-1.4.15.tar.gz
#cd nagios-plugins-1.4.15
#./configure –prefix=/usr/local/nagios –with-nagios-user=nagios –with-nagios-group=nagios
#make && make install
修改/usr/local/nagios/etc/objects/commands.cfg定义命令的文件添加如下内容
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
11、定义监控
修改/usr/local/nagios/etc/nagios.cfg
去掉cfg_dir=/usr/local/nagios/etc/servers前面的注释
mkdir //usr/local/nagios/etc/servers
添加文件cacti_56.cfg
define host{
use linux-server
host_name Cacti-56
alias Cacti-56
address 192.168.5.56
}
define service{
use generic-service
host_name Cacti-56
service_description CPU Load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name Cacti-56
service_description Current Users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name Cacti-56
service_description Disk Free Space /
check_command check_nrpe!check_root
}
define service{
use generic-service
host_name Cacti-56
service_description Total Processes
check_command check_nrpe!check_total_procs
}
define service{
use generic-service
host_name Cacti-56
service_description Zombie Processes
check_command check_nrpe!check_zombie_procs
}
define service{
use generic-service
host_name Cacti-56
service_description Swap Usage
check_command check_nrpe!check_swap
}
define service{
use generic-service
host_name Cacti-56
service_description disk_/
check_command check_nrpe!check_disk_/
}
define service{
use generic-service
host_name Cacti-56
service_description check_tcp_3306
check_command check_tcp!3306
}
检查配置文件service nagios checkconfig
重新载入service nagios reload
12、修改联系人配置文件/usr/local/nagios/etc/objects/contacts.cfg
define contact{
contact_name nagiosadmin
use generic-contact
alias Nagios Admin
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
email nagios@bobo365.com
}
define contact{
contact_name nagios
use generic-contact
alias nagios
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email nagios@bobo365.com
}
13、安装图形扩展工具pnp4nagios
安装依赖包yum -y install php-gd rrdtool-perl rrdtool librrds-perl perl-Time-HiRes
tar zxf pnp4nagios-0.6.6.tar.gz
cd pnp4nagios-0.6.6.tar.gz
./configure –with-nagios-user=nagios –with-nagios-group=nagcmd
make all
make install
make install-webconf
make install-config
make install-init
[root@KING pnp4nagios-0.6.19]# cd /usr/local/pnp4nagios/etc
[root@KING etc]# rename .cfg-sample .cfg *.cfg-sample
[root@KING etc]# cd pages/
[root@KING pages]# rename .cfg-sample .cfg *.cfg-sample
[root@KING pages]# cd ../check_commands/
[root@KING check_commands]# rename .cfg-sample .cfg *.cfg-sample
service npcd restart
修改nagios的主配置文件打开数据传输
vim nagios.cfg
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata #去掉注释
修改nagios的命令配置文件定义其使用的插件
vim commands.cfg
##添加
# ‘process-host-perfdata’ command definition
define command{
command_name process-host-perfdata
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
# ‘process-service-perfdata’ command definition
define command{
command_name process-service-perfdata
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
配置nagios的样本文件定义后续要引用的类
vim templates.cfg
define host {
name hosts-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=_HOST_
register 0
}
define service {
name services-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}
引用的类后面加上hosts-pnn或者services-pnp以“”隔开
重载nagios服务
/usr/local/pnp4nagios/var/perfdata/下生成以监控主机的cfg文件名的文件夹里面会有.rrd和.xml的文件
删除安装文件重启apache。
/usr/local/pnp4nagios/share/install.php
14、nagios报警邮件
关闭系统自身的邮件系统postfixservice postfix stop
wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.55.tar.gz
tar zxf sendEmail-v1.55.tar.gz
cd sendEmail-v1.55
cp sendEmail /usr/local/bin
chmod 755 /usr/local/bin/sendEmail
修改command.cfg文件:
command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$
\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” | /usr/local/bin/sendEmail -f nagios@bobo365.com -t $CONTACTEMAIL$ -s mail.bobo365.com -u “**
$NOTIFICATIONTYPE$ alert – $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” -xu nagios -xp XXXXXX
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&7
1 永久方法 – 需要重启服务器
修改/etc/selinux/config文件中设置SELINUX=disabled 然后重启服务器。
2 临时方法 – 设置系统参数
使用命令setenforce 0
附
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式