天天看點

centos7 nagios server端安裝

   記錄一下今天安裝nagios的問題,瞎搞了一天,終于是搞定了。下面說一下安裝步驟。

1.重點,不要用yum安裝,yum安裝的不能自己控制,設定權限,增加插件什麼的,不友善,不能自定義。

下面進行源碼編譯安裝,隻需要按照我的步驟,一定可行。

$ setenforce 0  ( 關閉selinux)

$ yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp openssl-devel wget unzip -y (安裝一些需要的依賴包)

$ useradd nagios ( 建立nagios使用者 ,提示已存在沒關系,無視)

$ groupadd nagcmd (建立nagcmd組,提示已存在沒關系,無視)

$usermod -a -G nagcmd nagios (将nagios使用者放入nagcmd組)

$usermod -a -G nagcmd apache (将apache使用者放入nagcmd組)

( 自己選擇一個位置 下載下傳并解壓nagios源碼包和必要插件包  )

$ wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz

$ wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz

$ tar zxf nagios-4.1.1.tar.gz

$ tar zxf nagios-plugins-2.1.1.tar.gz

$ cd nagios-4.1.1 ( 進入解壓後的目錄 )

$ ./configure --with-command-group=nagcmd (指定使用者組)

$ make all (編譯)

$ make install (安裝)

$ make install-init (設為系統服務)

$ make install-config  (自動設定配置)

$ make install-commandmode (自動增加預設指令)

$ make install-webconf (自動設定apache web界面配置)

$ htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin (設定web界面登陸賬号和密碼)

$ cd /tmp/nagios-plugins-2.1.1 ( 進入插件源碼目錄 )

$ ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl (指定使用者群組還 有開啟的子產品,這個子產品很重要,少了會無法通路web界面)

$make all

$make install (編譯 安裝)

$ service httpd start ( 開啟服務 ,也可用 systemctl start httpd )

$ service nagios start (開啟服務,也可用 systemctl start nagios)

ok,到此就安裝成功了,通路localhost:80/nagios 網址,輸入剛才設定的使用者名和密碼,即可進入nagios的web界面。

另外,要公網外部通路的話,自己 開啟80端口

接下來進行client端的安裝,請檢視:https://blog.csdn.net/weixin_41004350/article/details/78492313

繼續閱讀