|
Guides All Guides and HOWTO's. |
|
Thread Tools | Display Modes |
|
|||||
Guide: Solaris 10 - Nagios -rrdtool -pnp4Nagios
I know this is a *BSD forum but yall have given Solaris a place so I figured
this would be a good place to post my recent pet project. This is not a HOWTO, it is more of a guide. Any comments corrections are welcome.. We run a Solaris environment at work with primarily Solaris 10 and a few Solaris 9 boxes that are hopefully going away soon.. Nagios is something I learned about from this community years ago. I set it up on an OPenBSD box at my old job and it is still running today.. Ok.. On with the guide: This was done in a full root Solaris 10 zone on both SPARC and x86 architecture. Installation of Nagios 3.03 Download the following Source code from SourceForge or their respective site: Nagios -- nagios-3.03 Nagios Plugins -- nagios-plugins-1.4.12 http://www.nagios.org/download/ RRdTool -- rrdtool-1.2.9 http://oss.oetiker.ch/rrdtool/download.en.html CgiLib http://www.infodrom.org/projects/cgilib/download.php PHP -- php-5.2.6 http://www.php.net/downloads.php Lightweight CGI Library -- cgilib-0.5 http://www.infodrom.org/projects/cgilib/download.php PNP4Nagios -- pnp-0.4.10 http://www.pnp4nagios.org/pnp/start PNP4Nagios along with Rrdtool uses performance data and produces some very nice graphs. Set Root path to: Code:
/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/sfw/bin:/usr/ccs/bin:/usr/ucb Code:
# crle -u -l /usr/local/lib # crle -u -l /usr/local/ssl/lib If pkg-get in not installed on your system then download it here: http://www.bolthole.com/solaris/pkg-get.html After installing pkg-get Code:
# pkg-get -U Code:
# pkg-get install autoconf-2.62 bison-2.3 coreutils-6.4 expat-2.0.1 \ flex-2.5.4a fontconfig-2.4.2 freetype-2.3.1 gcc-3.4.6 \ gd-2.0.35 gtk+-1.2.10 jpeg-6b libpng-1.2.29 libtool-1.5.24 \ libiconv-1.9.2 libintl-3.4.0 make-3.81 mysql-5.0.51 \ ncurses-5.6 openssl-0.9.8h pkgconfig-0.20 \ zlib-1.2.3 netsnmp-5.4.1.1 libxml2- 2.6.31 Code:
# groupadd -g 667 nagios # useradd -d /usr/local/nagios -g nagios -u 666 -s /bin/false nagios Code:
# ./configure \ --prefix=/usr/local/nagios \ --enable-event-broker \ --with-gd-lib=/usr/local/lib \ --with-gd-inc=/usr/local/include \ --with-nagios-user=nagios \ --with-nagios-group=nagios \ --with-command-user=webservd \ --with-command-group=webservd \ --with-checkresult-dir=/usr/local/nagios/tmp/results \ --with-temp-dir=/usr/local/nagios/tmp \ --with-init-dir=/etc/init.d \ --with-lockfile=/usr/local/nagios/var/nagios.lock \ --with-cgiurl=/nagios/cgi-bin \ --with-htmurl=/nagios Code:
# make all # make install # make install-init # make install-commandmode # make install-config Code:
# cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf Code:
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin <Directory "/usr/local/nagios/sbin"> Options ExecCGI AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user </Directory> Alias /nagios /usr/local/nagios/share <Directory "/usr/local/nagios/share"> Options None AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user </Directory> Code:
# /usr/apache2/bin/apachectl configtest Syntax OK Code:
# svcadm enable http # svcs http STATE STIME FMRI online 12:10:19 svc:/network/http:apache2 Code:
# /usr/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users <username> # New password: # Re-type new password: Adding password for user <username> Code:
# /etc/init.d/nagios checkconfig Running configuration check...Killed CONFIG ERROR! Check your Nagios configuration. crle command to link the necessary libraries.. There should be /lib:/usr/lib:/usr/local/lib:/usr/local/ssl/lib in your crle output. Read on Quote:
Quote:
Code:
# /etc/init.d/nagios checkconfig Running configuration check... OK. Code:
# /etc/init.d/nagios start -n Starting nagios: done. # tail /usr/local/nagios/var/nagios.log [1214068735] Nagios 3.0.2 starting... (PID=13222) [1214068735] Local time is Sat Jun 21 12:18:55 CDT 2008 [1214068735] LOG VERSION: 2.0 [1214068735] Finished daemonizing... (New PID=13223) [1214068735] Error: Could not create external command file '/usr/local/nagios/var/rw/nagios.cmd' as named pipe: (13) -> Permission denied. If this file already exists and you are sure that another copy of Nagios is not running, you should delete this file. [1214068735] Bailing out due to errors encountered while trying to initialize the external command file... (PID=13223) We must add nagios to the webservd group Code:
# usermod -G webservd nagios used to run commands from the Web. *That* is why nagios needs to be a member of the webservd group Code:
# pwd /usr/local/nagios/var # ls -al total 64 drwxrwxr-x 4 nagios nagios 512 Jun 21 12:21 . drwxr-xr-x 9 root root 512 Jun 21 12:04 .. drwxrwxr-x 2 nagios nagios 512 Jun 21 12:03 archives -rw-r--r-- 1 nagios nagios 6 Jun 21 12:19 nagios.lock -rw-r--r-- 1 nagios nagios 755 Jun 21 12:19 nagios.log -rw-r--r-- 1 nagios nagios 12943 Jun 21 12:19 objects.cache drwxrwsr-x 2 webservd webservd 512 Jun 21 12:19 rw -rw-rw-r-- 1 nagios nagios 13165 Jun 21 12:21 status.dat # tail /usr/local/nagios/var/nagios.log [1214068797] Nagios 3.0.2 starting... (PID=13237) [1214068797] Local time is Sat Jun 21 12:19:57 CDT 2008 [1214068797] LOG VERSION: 2.0 Now let's check to see if we can access the web gui. Ok.. we can see the web after we get logged in but we don't have any permissions.. yet .. :-) Quote:
Mod the cgi file.. Code:
# vi /usr/local/nagios/etc/cgi.cfg and add <username> to every place nagiosadmin is located.. Woot.. Now lets compile the plugins After downloading the latest from Sourceforge Code:
# wget http://internap.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.12.tar.gz Code:
# ./configure \ --prefix=/usr/local/nagios \ --with-nagios-user=nagios \ --with-nagios-group=nagios \ --with-cgiurl=/nagios/cgi-bin \ --with-openssl=/usr/local/ssl \ --with-mysql=/usr/local/mysql/bin/mysql_config \ --with-snmpget-command=/usr/local/bin/snmpget \ --with-snmpgetnext-command=/usr/local/bin/snmpgetnext # make # make install Code:
# ls /usr/local/nagios/libexec check_apt check_file_age check_load check_ntp_peer check_rpc check_udp check_breeze check_flexlm check_log check_ntp_time check_sensors check_ups check_by_ssh check_ftp check_mailq check_nwstat check_simap check_users check_clamd check_hpjd check_mrtg check_oracle check_smtp check_wave check_cluster check_http check_mrtgtraf check_overcr check_snmp negate check_dig check_ifoperstatus check_nagios check_pgsql check_spop urlize check_disk check_ifstatus check_nntp check_ping check_ssh utils.pm check_disk_smb check_imap check_nntps check_pop check_ssmtp utils.sh check_dns check_ircd check_nt check_procs check_tcp check_dummy check_jabber check_ntp check_real check_time Compile php (note: php will not compile in a sparse root zone) Code:
# ./configure \ --prefix=/usr/local \ --with-apxs2=/usr/apache2/bin/apxs \ --with-openssl=/usr/local/ssl \ --with-gd=/usr/local \ --with-jpeg-dir=/usr/local \ --with-png-dir=/usr/local \ --with-freetype-dir=/usr/local \ --with-zlib=/usr/local \ --with-pear Looks like everything configured ok.. # make # make test (states that I may have found a bug in PHP) # make install Quote:
Code:
# /usr/apache2/bin/apachectl configtest [Sat Jun 21 20:12:06 2008] [warn] module php5_module is already loaded, skipping Syntax OK I tried the sunfreeware package 1.3.0 but it was missing something at the end could not find a path (which existed) so I went back to 1.2.9 Rrdtool 1.2.9(this version) uses cgilib-0.5.tar.gz Note: compile cgilib-0.5 and copy the files or rrdtool 1.2.9 will not compile properly. Add to Makefile Code:
CC=gcc then # make Copy the necessary files to their respective location # cp libcgi.a /usr/local/lib # cp cgi.h /usr/local/include Code:
# ./configure # make # make install Code:
# ./configure \ --prefix=/usr/local/nagios \ --with-nagios-user=nagios \ --with-nagios-group=nagios \ --with-rrdtool=/usr/local/rrdtool-1.2.9/bin/rrdtool Change the permissions if needed # chown -R nagios:nagios /usr/local/nagios/var/rrd # make all # make install # make install-init # make-nstall-config Quote:
box. The configuration file is locahost.cfg Use the localhost.cfg as a starting point to make other *.cfg files Note: Check_swap check_local_procs do not work out of the box.. Update: I have made few changes (edits based on comments) rk
__________________
All posts sent on ReCycled Electrons... Last edited by roundkat; 31st December 2008 at 03:08 PM. Reason: changed nobody to webservd (Solaris httpd user) fixed typos - more typos |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A Comprehensive Guide to FreeBSD | ijk | Book reviews | 1 | 29th July 2008 03:53 PM |
Nagios 2.12 locks | awd | FreeBSD Ports and Packages | 5 | 19th June 2008 10:38 AM |
Guide for KDE over SSH from Vista | ua549 | FreeBSD General | 13 | 13th June 2008 07:20 PM |
Compiling Nagios 3.02 | roundkat | Solaris | 1 | 2nd June 2008 09:09 PM |
Nagios issue | scottro | General software and network | 5 | 31st May 2008 10:18 AM |