![]() |
|
Guides All Guides and HOWTO's. |
![]() |
|
Thread Tools | Display Modes |
|
|||||
![]()
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 |
|
|||
![]()
Hi.. I have Nagios 3.0.3 installed with plugins on Solaris x86. The default localhost page comes up.
Within localhosts.cfg, when i added /usr and /var (they are seperate partitions), the page would not show this information. Similarly, when I add other windows hosts in windows.cfg, I cannot get them to show up information. I have installed Nagios in /nagios-3.0.3 and the plugins into /nagios-plugins.1.13.x. When I ran ./configure for both, I had used --prefix=/nagios.3.0.3 and --prefix=/nagios-plugins.1.13.x during compilation. As mentioned in your guide, using /usr/local/nagios as --prefix has significance besides using it as --prefix??? AND OTHER THING: Could be that solaris has firewall running on it? Appreciate an early reply, regards, Rahul |
|
|||
![]()
I have this working.. looks like --prefix is significant.. i recompiled plugins using --prefix=/nagios-3.0.3 and the remaining..
|
|
|||
![]()
HI, I am trying to configure rrdtool and cgilib as mentioned. I got the make file of cgilib and copy done appropriately but when I try to run ./configure for rrd tool here is the error I get:
bash-3.00# ./configure checking build system type... i386-pc-solaris2.10 checking host system type... i386-pc-solaris2.10 checking target system type... i386-pc-solaris2.10 checking for a BSD-compatible install... ./install-sh -c checking whether build environment is sane... yes checking for gawk... no checking for mawk... no checking for nawk... nawk checking whether make sets $(MAKE)... yes checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for a sed that does not truncate output... /usr/bin/sed checking for egrep... egrep checking for ld used by gcc... /usr/ccs/bin/ld checking if the linker (/usr/ccs/bin/ld) is GNU ld... no checking for /usr/ccs/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/ccs/bin/nm -p checking whether ln -s works... yes checking how to recognise dependent libraries... pass_all checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking dependency style of g++... gcc3 checking how to run the C++ preprocessor... g++ -E checking for g77... no checking for f77... no checking for xlf... no checking for frt... no checking for pgf77... no checking for fort77... no checking for fl32... no checking for af77... no checking for f90... no checking for xlf90... no checking for pgf90... no checking for epcf90... no checking for f95... no checking for fort... no checking for xlf95... no checking for ifc... no checking for efc... no checking for pgf95... no checking for lf95... no checking for gfortran... no checking whether we are using the GNU Fortran 77 compiler... no checking whether accepts -g... no checking the maximum length of command line arguments... 262144 checking command to parse /usr/ccs/bin/nm -p output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc static flag works... yes checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/ccs/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... yes checking dynamic linker characteristics... solaris2.10 ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool appending configuration tag "CXX" to libtool checking for ld used by g++... /usr/ccs/bin/ld checking if the linker (/usr/ccs/bin/ld) is GNU ld... no checking whether the g++ linker (/usr/ccs/bin/ld) supports shared libraries... yes checking for g++ option to produce PIC... -fPIC checking if g++ PIC flag -fPIC works... yes checking if g++ supports -c -o file.o... yes checking whether the g++ linker (/usr/ccs/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... solaris2.10 ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... no appending configuration tag "F77" to libtool checking for ANSI C header files... (cached) yes checking for dirent.h that defines DIR... yes checking for library containing opendir... none required checking for sys/stat.h... (cached) yes checking for sys/types.h... (cached) yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking time.h usability... yes checking time.h presence... yes checking for time.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking fp_class.h usability... no checking fp_class.h presence... no checking for fp_class.h... no checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking for unistd.h... (cached) yes checking ieeefp.h usability... yes checking ieeefp.h presence... yes checking for ieeefp.h... yes checking math.h usability... yes checking math.h presence... yes checking for math.h... yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking sys/times.h usability... yes checking sys/times.h presence... yes checking for sys/times.h... yes checking sys/param.h usability... yes checking sys/param.h presence... yes checking for sys/param.h... yes checking sys/resource.h usability... yes checking sys/resource.h presence... yes checking for sys/resource.h... yes checking float.h usability... yes checking float.h presence... yes checking for float.h... yes checking for an ANSI C-conforming const... yes checking whether time.h and sys/time.h may both be included... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for acos... no checking for acos in -lm... yes checking for strftime... yes checking for vprintf... yes checking for _doprnt... yes checking whether byte ordering is bigendian... no checking for tzset... yes checking for mbstowcs... yes checking for opendir... yes checking for readdir... yes checking for chdir... yes checking for chroot... yes checking for getuid... yes checking for setlocale... yes checking for strerror... yes checking for strerror_r... yes checking for snprintf... yes checking for vsnprintf... yes checking for fpclass... yes checking for class... no checking for fp_class... no checking for isnan... yes checking for memmove... yes checking for strchr... yes checking for mktime... yes checking for getrusage... yes checking for gettimeofday... yes checking for stdlib.h... (cached) yes checking for unistd.h... (cached) yes checking for getpagesize... yes checking for working mmap... yes checking for fpclassify... no checking for fpclassify with <math.h>... no checking for finite... yes checking for isinf... no checking for isinf with <math.h>... no checking if IEEE math works out of the box... yes checking for cgiInit in -lcgi... no checking for pkg-config... pkg-config configure: WARNING: ---------------------------------------------------------------------------- * I found a copy of pkgconfig, but there is no cgilib.pc file around. You may want to set the PKG_CONFIG_PATH variable to point to its location. ---------------------------------------------------------------------------- configure: WARNING: ---------------------------------------------------------------------------- * I could not find a working copy of cgilib. Check config.log for hints on why this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately so that compiler and the linker can find libcgi and its header files. If you have not installed cgilib, you can get it either from its original home on http://www.infodrom.org/projects/cgilib You can find also find an archive copy on http://people.ee.ethz.ch/~oetiker/we...dtool/pub/libs The last tested version of cgilib is 0.5. LIBS=-lm LDFLAGS= CPPFLAGS= ---------------------------------------------------------------------------- checking for art_vpath_add_point in -lart_lgpl_2... yes checking libart_lgpl/libart.h usability... yes checking libart_lgpl/libart.h presence... yes checking for libart_lgpl/libart.h... yes checking for zlibVersion in -lz... yes checking zlib.h usability... yes checking zlib.h presence... yes checking for zlib.h... yes checking for png_access_version_number in -lpng... yes checking png.h usability... yes checking png.h presence... yes checking for png.h... yes checking for FT_Init_FreeType in -lfreetype... yes checking ft2build.h usability... no checking ft2build.h presence... no checking for ft2build.h... no checking for pkg-config... (cached) pkg-config checking for FT_Init_FreeType in -lfreetype... yes checking ft2build.h usability... yes checking ft2build.h presence... yes checking for ft2build.h... yes configure: error: Please fix the library issues listed above and try again. |
|
|||
![]()
Well I had a SPARC box sitting in a lab collecting dust, so I figured I'll try this out, and I needed a Nagios box there anyways. I've been using nagios for a few years, but never touched RRDTools or PNP4Nagios.
Just a few things I'd like to add to your AWESOME guide. In your ./configure for your plugins - you just need --with-mysql, don't add in the = sign + path. As you can see from the print out of your plugins, check_mysql isn't in there. Also you have a typo in that configure command, the last word should be 'snmpgetnext' instead of 'snmpgetnetxt'. I had a lib missing, not the one you had (libgcc_s.so.1), even after the crle commands. I just created a sym link so that the lib would be in the folder. Might not be the best solution but it worked. I had a lot of trouble getting RRDTools to complie so I just installed the one on SunFreeware which was 1.2.19. Worked fine. I'm not a Solaris admin, and had a lot of problems with the pkg-get stuff. I ended up just downloading the packages from SunFreeware. Now I just need to figure how to actually use PNP4Nagios to my benefit... lol Thanks again for writing this great Guide! |
|
|||
![]() Quote:
This looks like you have rdtool 1.3.0 because of the "pkgconfig" error.. I remember seeing that error and running into the same compile issues as you have.. rk
__________________
All posts sent on ReCycled Electrons... |
|
|||||||
![]() Quote:
Quote:
MySql - I could never get the plugin to compile.. just never fixed the guide.. Quote:
issues.. Essentially, PHP made me go to a full root zone and crle did pretty much solve all the issues.. Quote:
the cgilib is what got me in compiling rrdtool-1.2.9 Quote:
it is just a tool to automate the download process nothing more.. I have also done the same thing when pkg-get doesn't work.. Note Here: pkg-get will also let update a package in place very easily Quote:
Quote:
Thanks for all the input..!! I am going to redo my installation with a few more features and will post the next guide here.. rk
__________________
All posts sent on ReCycled Electrons... |
![]() |
|
|
![]() |
||||
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 |