温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Nagios 服务端简单安装

发布时间:2020-06-30 03:55:29 来源:网络 阅读:390 作者:lvnian2009 栏目:移动开发

Nagios 服务端安装


第一步:修改YUM源码

cd /etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


第二步:调整字符集

echo 'export LC_ALL=C'>> /etc/profile

source /etc/profile

echo $LC_ALL

第三部:关闭防火墙

/etc/init.d/iptables stop

/etc/init.d/iptables stop

chkconfig iptables off

setenforce 0         #临时生效

sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config  #永久生效

setenforce 0    

sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config  


第四部:时间同步

/usr/sbin/ntpdate pool.ntp.org

echo '#time sync'>>/var/spool/cron/root

echo '*/10 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1'>>/var/spool/cron/root

crontab -l



第五步:安装相关依赖库

yum install gcc glibc glibc-common -y

yum install gd gd-devel -y

yum install httpd php php-gd -y

yum install mysql* -y


第六步:创建NAGIOS用户和组

/usr/sbin/useradd -m nagios

/usr/sbin/groupadd nagcmd

#/usr/sbin/useradd apache   ##如果不是yum安装的需要添加apache用户

/usr/sbin/usermod -a -G nagcmd nagios

/usr/sbin/usermod -a -G nagcmd apache

第七步:安装NAGIOS软件

[ ! -d /home/lvnian/tools  ] &&  mkdir /home/lvnian/tools -p

cd /home/lvnian/tools


tar xzf nagios-3.5.1.tar.gz

cd nagios

./configure --with-command-group=nagcmd

make all

make install

make install-init

make install-config

make install-commandmode

make install-webconf

cd ../


第八步:配置web认证

用于打开web页面时,输入用户和密码登录


htpasswd -cb /usr/local/nagios/etc/htpasswd.users lvnian 123456


把密码文件生成在/usr/local/nagios/etc/htpasswd.users的原因是:

[root@Nagios tools]# cat /etc/httpd/conf.d/nagios.conf |grep AuthUserFile

   AuthUserFile /usr/local/nagios/etc/htpasswd.users

   AuthUserFile /usr/local/nagios/etc/htpasswd.users

[root@Nagios tools]# 



第九步:安装ngios插件

cd /home/lvnian/tools

yum -y install perl-devel

tar zxf nagios-plugins-1.4.16.tar.gz

cd nagios-plugins-1.4.16

./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-perl-modules

make && make install

ls /usr/local/nagios/libexec/|wc -l


cd /home/lvnian/tools

tar zxvf nrpe-2.12.tar.gz

cd nrpe-2.12

./configure 

make all

make install-plugin

make install-daemon

make install-daemon-config

cd ..


第十部:启动nagios

/etc/init.d/nagios start

/etc/init.d/httpd start

lsof -i tcp:80

ps -ef|grep nagios



打开http://10.0.0.3/nagios/ 即可进入nagios页面

输入用户名:lvnian

    密码  : 123456

Nagios 服务端简单安装

Nagios 服务端简单安装


简单安装完成

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI