InstallNagios-创新互联

Add nagios for nagios system:
# useradd nagios –s /sbin/nologin

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名与空间、雅安服务器托管、营销软件、网站建设、洮北网站维护、网站推广。

Install nagios:
# tar zvxf nagios-3.5.0.tar.gz
# cd nagios
# ./configure --prefix=/usr/local/nagios \
# --with-nagios-user=nagios \
# --with-nagiso-group=nagios \
# --sysconfdir=/etc/nagios
# make all
# make install
# make install-init
# make install-commandmode
# make install-config
# make install-webconf
# htpasswd -c /etc/nagios/htpasswd.users nagios

# vi /etc/nagios/cgi.cfg

authorized_for_system_information=nagios
authorized_for_configuration_information=nagios
authorized_for_system_commands=nagios
authorized_for_all_services=nagios
authorized_for_all_hosts=nagios
authorized_for_all_service_commands=nagios
authorized_for_all_host_commands=nagios

# chown nagios:nagios /etc/nagios/htpasswd.users

Install nagios-plugins:
# tar xzf nagios-plugins-1.4.16.tar.gz
# cd nagios-plugins-1.4.16
# ./configure --prefix=/usr/local/nagios \
# --with-nagios-user=nagios \
# --with-nagios-group=nagios \
# --sysconfdir=/etc/nagios
# make
# make install

Configuration file syntax checking:
# /usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg

Start HTTP & nagios:
# service httpd start
# service nagios start

Testing nagios web site as following:
http://localhost/nagios

Install rrdtool:
# tar xzf rrdtool-1.4.7.tar.gz
# cd rrdtool-1.4.7
# ./configure --prefix=/usr/local/rrdtool \
# --sysconfdir=/etc/rrdtool
# make
# make install

Install PNP4nagios plugins with nagios:
# tar zvxf pnp4nagios-0.6.21.tar.gz
# cd pnp4nagios-0.6.21
# ./configure --prefix=/usr/local/pnp4nagios \
# --with-rrdtool=/usr/local/rrdtool/bin/rrdtool \
# --with-nagios-user=nagios \
# --with-nagios-group=nagios \
# --sysconfdir=/etc/pnp \
# --with-httpd-conf=/etc/httpd/conf.d
# make all
# make install
# make install-webconf

Modify pnp4nagios configuration file:
# vi /etc/httpd/conf.d/pnp4nagios.conf

AuthUserFile        /etc/nagios/htpasswd.users

# make install-config
# make install-init

Integration of the PNP4Nagios and Nagios:
# vi /etc/nagios/nagios.cfg

#The corresponding part of the amended as follows:
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata

# vi /etc/nagios/objects/commands.cfg

#The corresponding part of the amended as follows:
define command{
    command_name    process-host-perfdata
    command_line    /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
    }
define command{
    command_name    process-service-perfdata
    command_line    /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
    }
# vi /etc/nagios/objects/templates.cfg

#Add by Kingcraft
define host{
    name            host-pnp
    register        0
    action_url      /pnp4nagios/graph?host=$HOSTNAME$
    }
define service{
    name            srv-pnp
    register        0
    action_url      /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
    }

PNP4Nagios display graphics in the the nagios host or service by adding host-pnp, srv-pnp, as follows:

# vi /etc/nagios/objects/localhost.cfg

define host{
    use            linux-server,host-pnp
    host_name      localhost
    alias          localhost
    address        127.0.0.1
    }
define service{
    use                    local-service,srv-pnp
    host_name              localhost
    service_description    PING
    check_command          check_ping!100.0,20%!500.0,60%
    }

Restart HTTP & nagios:
# service httpd restart
# service nagios restart

Delete /usr/local/pnp4nagios/share/install.php,Otherwise it can not be viewed:
# rm /usr/local/pnp4nagios/share/install.php

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


当前文章:InstallNagios-创新互联
URL链接:http://ybzwz.com/article/ddijjh.html