您好,登錄后才能下訂單哦!
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
簡單安裝完成
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。