安裝Nagvis

urgel_babay發表於2016-05-11
安裝Nagvis



# tar zxvf nagvis-1.8.4.tar.gz
# cd nagvis-1.8.4


# sh install.sh
+——————————————————————————+
| Welcome to NagVis Installer 0.2.16                                           |
+——————————————————————————+
| This script is built to facilitate the NagVis installation and update        |
| procedure for you. The installer has been tested on the following systems:   |
| – Debian Etch, Hardy (4.0, 5.0)                                              |
| – Ubuntu Hardy, Intrepid, Jaunty, Karmic, Lucid (8.04 to 10.04)              |
| – SuSE Linux Enterprise Server 10 and 11                                     |
|                                                                              |
| Similar distributions to the ones mentioned above should work as well.       |
| That (hopefully) includes RedHat, Fedora, CentOS, OpenSuSE                   |
|                                                                              |
| If you experience any problems using these or other distributions, please    |
| report that to the NagVis team.                                              |
+——————————————————————————+
| Do you want to proceed? [y]: 直接回車
+——————————————————————————+
| Starting installation of NagVis 1.5.1                                        |
+——————————————————————————+
| OS  : CentOS release 5.5 (Final)                                             |
| Perl: 5.008008                                                               |
|                                                                              |
+— Checking for tools ——————————————————-+
| Using packet manager /bin/rpm                                          found |
|                                                                              |
+— Checking paths ———————————————————–+
| Please enter the path to the nagios base directory [/usr/local/nagios]: 直接回車
|   nagios path /usr/local/nagios                                        found |
| Please enter the path to NagVis base [/usr/local/nagvis]: 直接回車
|                                                                              |
+— Checking prerequisites —————————————————+
| Nagios 3.1.2                                                           found |
| PHP 5.2                                                                found |
|   PHP Module: gd compiled_in                                           found |
|   PHP Module: mbstring compiled_in                                     found |
|   PHP Module: gettext compiled_in                                      found |
|   PHP Module: session compiled_in                                      found |
|   PHP Module: xml php                                                  found |
|   Apache mod_php                                                       found |
| Checking Backends. (Available: mklivestatus,ndo2db,ido2db,merlinmy)          |
| Do you want to use backend mklivestatus? [y]:n
| Do you want to use backend ndo2db? [n]: y                       //用ndo2db資料庫方式
| Do you want to use backend ido2db? [n]: 直接回車
| Do you want to use backend merlinmy? [n]: 直接回車
|   /usr/local/nagios/bin/ndo2db-3x (ndo2db)                             found |
|   PHP Module: mysql php                                                found |
| Graphviz 2.26                                                          found |
|   Graphviz Module dot 2.26.3                                           found |
|   Graphviz Module neato 2.26.3                                         found |
|   Graphviz Module twopi 2.26.3                                         found |
|   Graphviz Module circo 2.26.3                                         found |
|   Graphviz Module fdp 2.26.3                                           found |
|                                                                              |
+— Trying to detect Apache settings —————————————–+
| Please enter the web path to NagVis [/nagvis]: /nagios/nagvis
| Please enter the name of the web-server user [apache]: 直接回車         //web使用者,在httpd.conf中User後面的使用者
| Please enter the name of the web-server group [apache]: 直接回車    //web使用者組,在httpd.conf中Group後面的使用者
| create Apache config file [y]:  直接回車                               //是否建立Apache的配置檔案來支援nagvis
|                                                                              |
+— Checking for existing NagVis ———————————————+
| NagVis 1.5.1                                                           found |
| Do you want the installer to update your config files when possible? [y]: 直接回車
|                                                                              |


+— Checking for existing NagVis ———————————————+
|                                                                              |
+——————————————————————————+
| Summary                                                                      |
+——————————————————————————+
| NagVis home will be:           /usr/local/nagios/share/nagvis                |
| Owner of NagVis files will be: apache                                        |
| Group of NagVis files will be: apache                                        |
| Path to Apache config dir is:  /etc/httpd/conf.d                             |
| Apache config will be created: YES                                            |
|                                                                              |
| Installation mode:             install                                       |
|                                                                              |
| Do you really want to continue? [y]: 直接回車
+——————————————————————————+
| Starting installation                                                        |
+——————————————————————————+
| Creating directory /usr/local/nagios/share/nagvis…                   done  |
| Creating directory /usr/local/nagios/share/nagvis/var…               done  |
| Creating directory /usr/local/nagios/share/nagvis/var/tmpl/cache…    done  |
| Creating directory /usr/local/nagios/share/nagvis/var/tmpl/compile…   done  |
| Creating directory /usr/local/nagios/share/nagvis/share/var…         done  |
| Copying files to /usr/local/nagios/share/nagvis…                     done  |
| *** /usr/local/nagios/share/nagvis/etc/nagvis.ini.php will NOT be overwritte |
| *** creating /usr/local/nagios/share/nagvis/etc/nagvis.ini.php.inst instead  |
| Creating main configuration file…                                    done  |
| adding sesscookie=/nagios/nagvis                                       done  |
| adding base=”/usr/local/nagios/share/nagvis”                           done  |
| adding htmlbase=”/nagios/nagvis”                                       done  |
| setting backend to ndomy_1                                             done  |
| *** creation of /etc/httpd/conf.d/nagvis.conf will be SKIPPED !              |
|                                                                              |
+— Setting permissions… —————————————————+
| /usr/local/nagios/share/nagvis/etc/nagvis.ini.php-sample               done  |
| /usr/local/nagios/share/nagvis/etc                                     done  |
| /usr/local/nagios/share/nagvis/etc/maps                                done  |
| /usr/local/nagios/share/nagvis/etc/maps/*                              done  |
| /usr/local/nagios/share/nagvis/etc/automaps                            done  |
| /usr/local/nagios/share/nagvis/etc/automaps/*                          done  |
| /usr/local/nagios/share/nagvis/share/userfiles/images/maps             done  |
| /usr/local/nagios/share/nagvis/share/userfiles/images/maps/*           done  |
| /usr/local/nagios/share/nagvis/share/userfiles/images/shapes           done  |
| /usr/local/nagios/share/nagvis/share/userfiles/images/shapes/*         done  |
| /usr/local/nagios/share/nagvis/var                                     done  |




重啟apache
service httpd restart






登入
URL:




需要修改檔案  nagvis.conf
[root@nagios ~]# cd /etc/httpd/conf.d/
[root@nagios conf.d]# ll
total 40
-rw-r--r-- 1 root   root     239 Jun  2 18:51 centreon.conf
-rw-r--r-- 1 root   root     239 Jun  2 18:51 centreon.conf-bak
-rw-r--r-- 1 root   mailman  641 Nov 21  2012 mailman.conf
-rw-r--r-- 1 root   root     982 Jun  2 19:07 nagios.conf
-rw-r--r-- 1 apache apache  2438 Jun  3 16:35 nagvis.conf
-rw-r--r-- 1 apache apache  2612 Jun  3 16:12 nagvis.conf.2015-06-03_16:11:50
-rw-r--r-- 1 root   root    1796 Apr 22  2005 perl.conf
-rw-r--r-- 1 root   root     674 Feb 22  2013 php.conf
-rw-r--r-- 1 root   root     392 Feb 22  2013 README
-rw-r--r-- 1 root   root     299 Dec  5  2012 welcome.conf




[root@nagios conf.d]# vi nagvis.conf
# NagVis Apache2 sample configuration file
#
# #############################################################################


Alias /nagvis "/usr/local/nagvis/share"


<Directory "/usr/local/nagvis/share">
  Options FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all


  # To enable Nagios basic auth on NagVis use the following options
  # Just uncomment it. Maybe you need to adjust the path to the
  # Auth user file.
  #
  # If you use the NagVis internal auth mechanism based on the web
  # for you won't need this.
  #
  #AuthName "NagVis Access"
  #AuthType Basic
  #AuthUserFile /usr/local/nagios/etc/htpasswd.users
  #Require valid-user


  # With installed and enabled mod_rewrite there are several redirections
  # available to fix deprecated and/or wrong urls. None of those rules is
  # mandatory to get NagVis working.
  <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /usr/local/nagvis/www


    # Use mod_rewrite for old url redirection even if there are php files which
    # redirect the queries itselfs. In some cases the mod_rewrite redirect
    # is better than the php redirect.
    #
    # Using the php redirect seems to be better in some cases where https/http servers
    # are mixed. For example in OMD setups where using apache own mode and https in the
    # frontend and http in the backend apache servers.
    #
    # Disabling this redirect by default in the hope that the php direct works better.
    #RewriteCond %{REQUEST_URI} ^/usr/local/nagvis/www(/config\.php|/index\.php|/|)(\?.*|)$
    #RewriteRule ^(.*)$ /usr/local/nagvis/www/frontend/nagvis-js/%1%2 [R=301,L]


    # Redirect old regular map links
    RewriteCond %{REQUEST_URI} ^/usr/local/nagvis/www/frontend/(wui|nagvis-js)
    RewriteCond %{QUERY_STRING} map=(.*)
    RewriteRule ^(.*)$ /usr/local/nagvis/www/frontend/nagvis-js/index.php?mod=Map&act=view&show=%1 [R=301,L]


    # Without map= param
    RewriteCond %{REQUEST_URI} ^/usr/local/nagvis/www/frontend(/wui)?/?(index.php)?$
    RewriteRule ^(.*)$ /usr/local/nagvis/www/frontend/nagvis-js/index.php [R=301,L]


    # Redirect old rotation calls
    RewriteCond %{REQUEST_URI} ^/usr/local/nagvis/www/frontend/nagvis-js
    RewriteCond %{QUERY_STRING} !mod
    RewriteCond %{QUERY_STRING} rotation=(.*)
    RewriteRule ^(.*)$ /usr/local/nagvis/www/frontend/nagvis-js/index.php?mod=Rotation&act=view&show=%1 [R=301,L]
  </IfModule>
</Directory>


主要是這句
Alias /nagvis "/usr/local/nagvis/share"


這樣修改重啟httpd後就可以直接訪問了,

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30936525/viewspace-2097976/,如需轉載,請註明出處,否則將追究法律責任。

相關文章