...
Code Block | ||
---|---|---|
| ||
su root apt-get install autoconf automake gcc make apt-get install libcairo2 libcairo2-dev libglib2.0-dev libpango1.0-dev libxml2 libxml2-dev apt-get install net-snmp net-snmp-lib net-snmp-utils net-snmp-perl apt-get install apache2 |
Korn Shell (ksh) and Bourne-Again Shell (bash) both work well.
RRDTool Installation
We now need to get a copy of RRDtool, by Tobi Oetiker. The NMIS development team recommend that you download the latest stable RRDtool and compile it, instead of using whatever version of RRDtool may come with your distribution. The latest version of RRD is available at http://oss.oetiker.ch/rrdtool/.
Unpack the RRDtool tarball. NMIS8 has been testing using v1.4.5 and for this example. To build and install a “GNU” make based system, you run ./configure, then make, then make install, for RRDTool for NMIS we need a configure option setup.
Code Block |
---|
./configure --enable-shared --prefix=/usr/local/rrdtool |
When this step is finished, you should see something like this:
Code Block |
---|
ordering CD from http://tobi.oetiker.ch/wish .... just kidding ;-) ---------------------------------------------------------------- Config is DONE! With MMAP IO: yes Build rrd_getopt: no Static programs: no Perl Modules: perl_piped perl_shared Perl Binary: /usr/bin/perl Perl Version: 5.8.8 Perl Options: PREFIX=/usr/local/rrdtool LIB=/usr/local/rrdtool/lib/perl/5.8.8 Ruby Modules: Ruby Binary: no Ruby Options: sitedir=/usr/local/rrdtool/lib/ruby Build Lua Bindings: no Build Tcl Bindings: no Build Python Bindings: no Build rrdcgi: yes Build librrd MT: yes Use gettext: yes With libDBI: no Libraries: -lxml2 -lcairo -lcairo -lcairo -lm -lcairo -lpng12 -lglib-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 Type 'make' to compile the software and use 'make install' to install everything to: /usr/local/rrdtool. ... that wishlist is NO JOKE. If you find RRDtool useful make me happy. Go to http://tobi.oetiker.ch/wish and place an order. -- Tobi Oetiker <tobi@oetiker.ch> ---------------------------------------------------------------- |
So far, so good. You have all the things RRDtool needs to compile. Let's keep going.
Code Block |
---|
make && make install |
Now, rrdtool should be installed the way NMIS likes it.
NMIS8 Installation
And speaking of NMIS, if you haven't already downloaded it, the latest version (v8.3.1 at time of this writing) is available at http://opmantek.com
Code Block |
---|
tar -xvzf nmis-8.1.1.tar.gz cd nmis8/ |
At this point, I like to copy this entire directory to the /usr/local directory tree and make some symlinks, like so.
Code Block |
---|
cp -Rpv nmis8/ /usr/local/ cd /usr/local |
My <nmisdir> is, in this case, /usr/local/nmis8. For those who have been using NMIS for a while, make a /usr/local/nmis.
Code Block |
---|
ln -s nmis8 nmis |
The <nmisdir> tree needs to be owned by the user "nmis", which doesn't exist yet. Furthermore, the userID under which Apache runs ("apache" on Red Hat and "wwc-data" on Debian) needs to have access to the <nmisdir> tree. So, we need to add to make these things happen. We are still in the /usr/local directory at this point.
Code Block |
---|
useradd nmis groupadd nmis #this may return "groupadd: group 'nmis' already exists" this can safely be ignored but if you want to verify try this: groups nmis |
Now we add the Apache userID to the nmis group.
Code Block |
---|
usermod -G nmis apache (Red Hat/CentOS) usermod -G nmis www-data (Debian) |
NOTE: the stuff that used to be sitting in <nmisdir>/conf in previous NMIS tarballs is now located in <nmisdir>/install. Since we're doing a new installation here, we'll just copy everything in <nmisdir>/install to <nmisdir>/conf.
Code Block |
---|
cd /usr/local/nmis8 cp –Rpv install/* conf |
Perl CPAN Module Installation
Now, let's get busy with the PERL modules. NMIS, being written in PERL, uses several PERL subroutines, known as "PERL modules". These are available from the Comprehensive PERL Archive Network, known affectionately as "CPAN". No, not "C-SPAN", I mean "CPAN". :-)
Here's how we get to CPAN.
Code Block |
---|
perl -MCPAN -e "shell" |
You will be asked a bunch of questions. It is safe to select all the defaults. Indeed, if you don't know what the questions are asking you, selecting the defaults is strongly recommended! HOWEVER, with some distros (Debian is a notable exception) you must select some CPAN mirrors, because that's where you're going to download your PERL modules from. Choose those which are closest to you. For me, that's North America; for Peruvians and Brazilians, that's South America; and so on.
On some distros like Red Hat/CentOS, you should start with this command. Debian doesn't seem to require it, which is good, because the command doesn't work on Debian's CPAN client anyway. :-)
Code Block |
---|
$cpan> o conf set LC_ALL=C #(Red Hat/CentOS) |
Additionally, I like to ensure my CPAN client program, which is what we're running ("CPAN.pm"), is the latest, up-to-date version. This will take a while and ask for several other "dependency" modules. Just tell it "yes" each time. If you would like to have cpan automatically choose yes use this code:
Code Block |
---|
$cpan> o conf prerequisites_policy follow $cpan> o conf commit #use this if you want to save this setting for next time |
And run this code to do the update:
Code Block |
---|
$cpan> install Bundle::CPAN $cpan> reload cpan |
OK, we've got CPAN prepped, locked, and loaded. :-) Now, install all the PERL modules listed in the official NMIS docs, like so.
$cpan>
Code Block |
---|
install JSON install Proc::ProcessTable install Image::Resize install Net::SNMP install Time::HiRes install Time::ParseDate install Statistics::Lite install Net::SNPP install Net::SMTP install Net::DNS # Only required if using DNS lookups for geoplots install IPC::Shareable # Only required if multithreading on Unix/Linux. install BSD::Resource # Only required if multithreading on Unix/Linux. install GD::Graph # Only required for Capacity Planning tool. install Net::EasyTCP # Only required for master slave operation. install Data::Dumper # Required for cgi metrics stats caching install Cache::Mmap # required for caching cgi metric stat install Proc::Queue install Date::Parse install Date::Calc install Math::Round install DBI install CGI::Pretty #Now, you're ready to exit CPAN. exit |
Unix File Permissions
Make nmis user and group own all the files.
Code Block |
---|
chown -Rv nmis:nmis <nmisdir> chmod -Rv g+w <nmisdir> |
If you decide on a different user and group name, update the NMIS Configuration Config.nmis accordingly.
One of the joys of Unix is granular file permissions, one of the frustrations of Unix is granular file permissions. To assist we have added a handy script in the admin directory <nmisdir>/admin/fixperms.pl which will read the NMIS Configuration and fix the permissions accordingly.
Code Block |
---|
admin/fixperms.pl # This script will fix the permissions for NMIS based on the configuration /usr/local/nmis8/admin/../conf/Config.nmis # The directory to be processed is: /usr/local/nmis8 # The user will be set to: nmis # The group will be set to: nmis |
Initial NMIS Test
You should now be set. As an initial check, I like to go into my <nmisdir>/cgi-bin directory and run
Code Block |
---|
cd /usr/local/nmis8/cgi-bin ./nmiscgi.pl |
and see what happens. If all is working, you should get a bunch of HTML code. If you don't, it'll probably be NMISCGI complaining that it cannot find a given PERL module. Review your steps above; you likely missed something. The important thing to do is not to panic.
Initial NMIS Troubleshooting
RRDTool Libraries not Found
(This should no longer be a problem on NMIS8, but if you did something different with RRDTool, this is an easy way to fix it.)
For some reason, on some distros, NMIS will not be able to find the file RRDs.pm, which is a PERL module that comes with RRDtool, and that NMIS needs to be able to find and use. I ran into this problem. Fortunately, the NMIS development team included a small hack to take care of this. The line explicitly "uses" the RRDs.pm file in the/usr/local/rrdtool directory tree, but you have to uncomment that line in the NMIS program files themselves.
One way to quickly accomplish that is to run the following script within /usr/local/nmis8/bin and /usr/local/nmis8/cgi-bin. You can just cut 'n' paste it into your terminal.
Code Block |
---|
#!/bin/bash
for file in *.pl
do
sed -i 's|#use lib "/usr/local/rrdtool|use lib "/usr/local/rrdtool|g' $file
done |
NMIS Config Test
Once this is working, you're ready to head into the <nmisdir>/bin directory and do the "acid" test.
Code Block |
---|
# cd /usr/local/nmis8/bin
# ./nmis.pl type=config debug=true |
You should get what looks like a long checklist with "OK" at the end of every check. If you do this, then NMIS itself is configured correctly. The output will look something like this:
Code Block |
---|
# ./nmis.pl type=config debug=true
NMIS version 8.1.1
Root directory of NMIS is /usr/local/nmis8
05:20:05 checkConfig, Config Checking - Checking database directories
05:20:05 loadTable, ERROR file does not exist dir=var name=nmis-event
05:20:05 writeHashtoFile, write data to /usr/local/nmis8/var/nmis-event.nmis
05:20:05 loadTable, ERROR file does not exist dir=var name=nmis-system
05:20:05 writeHashtoFile, write data to /usr/local/nmis8/var/nmis-system.nmis
Continue with bin/nmis.pl type=apache for configuration rules of the Apache web server |
The errors above are OK, NMIS will fix them itself.
NMIS Web Server Setup
Now, we need to set up the Web server so that folks can actually *get to* NMIS and look at the data. :-) That means generating an Apache config file pointing to the NMIS directory tree. NMIS itself is smart enough to be able to generate this for us. Thanks, NMIS team!
All you have to do is this.
Code Block |
---|
./nmis.pl type=apache > 00nmis.conf |
The main part of the Apache config is as follows.
Code Block |
---|
# NMIS Aliases
Alias /nmis8/ "/usr/local/nmis8/htdocs/"
<Directory "">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /menu8/ "/usr/local/nmis8/menu/"
<Directory "/menu8">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-nmis8/ "/usr/local/nmis8/cgi-bin/"
<Directory "/usr/local/nmis8/cgi-bin">
Options +ExecCGI
Order allow,deny
Allow from all
</Directory> |
You can use whatever filename you want instead of "00nmis.conf". This is very distro-dependent. On CentOS and other Red Hat derivatives, this directory is/etc/httpd/conf.d/. On Debian-style distributions, it's /etc/apache2/sites-available/, and you must also make a symlink to that file from /etc/apache2/sites-enabled.
Note that Debian has an existing "000-default" symlink in /etc/apache2/sites-enabled. Remembering how Apache processes config files, we must rename this symlink to something like "default" without the "000"! This is so "00nmis.conf" will be seen first. Otherwise you'll get the Apache default home page ("It Works!") instead of the NMIS home page. Not what we want. :-)
Debian systems have one other requirement for this file. Two lines need to be edited, specifically the "ErrorLog" and "CustomLog" lines. The lines as they are point to locations present in Red Hat-style distros (this is really Red Hat following Apache's upstream functionality). Debian doesn't do that. Therefore, Apache will complain and refuse to start unless we make these tweaks.
Since Debian puts its Apache logs under /var/log/apache2, I edited these lines to read as follows.
ErrorLog /var/log/apache2/nmis-dev-error_log
CustomLog /var/log/apache2/nmis-dev-access_log common
You can also integrate the above extract into your existing web server configuration under its own virtual host, or into an existing set of hosts. This means you can run other version of NMIS on the same server, or for different customers for example, this is intended to be flexible for alternate integration.
Now that your NMIS config file for Apache is present--and if necessary, tweaked for your distro--start Apache itself. If it's already started, then restart it. How to do this is also very distro-dependent. Unlike me, BSD and Solaris users don't need no steenkin' startup scripts. :-)
Auto Start HTTPD Server
Ensure that you tell Linux to start HTTPD automatically
# /sbin/chkconfig httpd on
Start HTTPD Server
You will need to start or restart Apache after configuration, on CentOS:
# /etc/init.d/httpd start
or
# /etc/init.d/httpd restart
If you get an error like this, it just means the hostname and FQDN on the Linux box hasn’t been setup right, verify you have this setup correctly and update the httpd.conf for Apache accordingly.
Starting httpd: httpd: apr_sockaddr_info_get() failed for nmis-dev
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName