2014年1月15日 星期三

Install Nagios vShell

Install Nagios vShell

1.下載 vshell
wget http://assets.nagios.com/downloads/exchange/nagiosvshell/vshell.tar.gz

2.解壓縮
tar xvzf vshell.tar.gz

3.搬移目錄
mv vshell /usr/local

4.複製檔案到 /etc/httpd/conf.d 目錄之下
cp /usr/local/vshell/config/vshell_apache.conf /etc/httpd/conf.d

5.修改 /etc/httpd/conf.d/vshell_apache.conf
vim /etc/httpd/conf.d/vshell_apache.conf
#modify this file to fit your apache configuration
Alias /vshell "/usr/local/vshell"
<Directory "/usr/local/vshell">
#  SSLRequireSSL
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
#  Allow from 127.0.0.1
#use the below lines for Nagios XI
 # AuthName "Nagios Monitor XI"
 #  AuthType Basic
 # AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users

#Use the below lines for a typical Nagios Core installation
   AuthName "Nagios Access"
   AuthType Basic
   
AuthUserFile /etc/nagios/htpasswd.users (依據自己apache passwd檔路徑)

   Require valid-user
</Directory>


6.修改 /usr/local/vshell/config/vshell.conf 設定檔
vim /usr/local/vshell/config/vshell.conf

; Full filesystem path to the Nagios status file
STATUSFILE = "/usr/local/nagios/var/status.dat"
; Full filesystem path to the Nagios object cache file
OBJECTSFILE = "/usr/local/nagios/var/objects.cache"
; Full filesystem path to the Nagios CGI permissions configuration file
CGICFG = "/usr/local/nagios/etc/cgi.cfg"
; Full filesystem path to the Nagios command pipe
NAGCMD = "/usr/local/nagios/var/rw/nagios.cmd"


修改成
; Full filesystem path to the Nagios status file
STATUSFILE = "/var/log/nagios/status.dat"  
 (依據自己status.dat檔路徑)
; Full filesystem path to the Nagios object cache file
OBJECTSFILE = "/var/log/nagios/objects.cache
 (依據自己objects.cache檔路徑)
; Full filesystem path to the Nagios CGI permissions configuration file
CGICFG = "/etc/nagios/cgi.cfg
 (依據自己cgi.cfg檔路徑)
; Full filesystem path to the Nagios command pipe
NAGCMD = "/var/spool/nagios/cmd/nagios.cmd
 (依據自己nagios.cmd檔路徑)

7.確認 /usr/local/vshell/install.php檔,裡面是否如下列路徑
*In Ubuntu and debian default path
define('TARGETDIR',"/usr/local/vshell"); 
define('APACHECONF',"/etc/apache2/conf.d");
*In centos default path
define('TARGETDIR',"/usr/local/vshell"); 
define('APACHECONF',"/etc/httpd/conf.d");
8.進到 /usr/local/vshell,執行install.php
   改權限  chmod +x install.php
   執行      ./install.php 
root@ip1019621483:~/vshell# ./install.php
Copying apache configuration file...
Copying vshell configuration file...
Creating web directory...
Copying files...
Cleaning up...
Restarting apache...
* Restarting web server apache2
... waiting ...done.
Checking for file locations...
NOTICE: Objects file found at: /var/cache/nagios3/objects.cache
***Update this location in your /etc/vshell.conf file***
NOTICE: Status file found at: /var/cache/nagios3/status.dat
***Update this location in your /etc/vshell.conf file***
NOTICE: cgi.cfg file found at: /etc/nagios3/cgi.cfg
***Update this location in your /etc/vshell.conf file***
NOTICE: Nagios cmd file found at: /var/lib/nagios3/rw/nagios.cmd
***Update this location in your /etc/vshell.conf file***
Script Complete!

9.重新啟動 Apache Web Server
service httpd restart

10.Link http://nagios's ip address/vshell


沒有留言:

張貼留言