Wednesday, November 30, 2016

compile and install nagios nrpe 2.15 on ubuntu 12.04 lts

 compile and install nagios nrpe 2.15 on ubuntu 12.04 lts  
   
 DISTRIB_ID=Ubuntu  
 DISTRIB_RELEASE=12.04  
 DISTRIB_CODENAME=precise  
 DISTRIB_DESCRIPTION="Ubuntu 12.04.3 LTS"  
   
 download and install gz'd code in /usr/local/src  
   
 add nagios user  
 # useradd -c "nagios system user" -d /usr/local/nagios -m nagios   
 # groupadd nagios   
 # chown nagios:nagios /usr/local/nagios  
    
 compile and install nrpe    
 # gunzip nrpe-2.15.tar.gz   
 # tar xvf nrpe-2.15.tar   
 # cd nrpe-2.15   
 # ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu  
 # make && make install   
   
 /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/bin  
 /usr/bin/install -c -m 775 -o nagios -g nagios nrpe /usr/local/nagios/bin  
   
 # make install-daemon-config   
   
 /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc  
 /usr/bin/install -c -m 644 -o nagios -g nagios sample-config/nrpe.cfg /usr/local/nagios/etc  
   
 # gunzip nagios-plugins-1.4.16.tar.gz  
 # tar xvf nagios-plugins-1.4.16.tar  
 # cd nagios-plugins-1.4.16/  
 # ./configure --without-mysql  
 # make && make install  
   
 ...  
   
 * note  
   
 i'm hardcoding the libs for nrpe because  
 configure does this...  
   
 checking for type of socket size... size_t  
 checking for SSL headers... SSL headers found in /usr  
 checking for SSL libraries... configure: error: Cannot find ssl libraries  
   
 meh  
   
 # apt-get install libssl-dev  
 # ldconfing  
 # apt-file search libssl | grep libssl-dev  
   
 ...  
   
 set up the nrpe daemon  
 # echo 'nrpe 5666/tcp # NRPE' >> /etc/services   
 # cp /usr/local/src/nrpe-2.15/init-script.debian /etc/init.d/nrpe  
 # chmod +x /etc/init.d/nrpe  
 # sysv-rc-conf  
   
 set to runlevels 2 3 4 5  
 q to exit :^)  
   
 edit nrpe.cfg to site specs  
 # vi /usr/local/nagios/etc/nrpe.cfg  
   
 run nrpe daemon  
 # /etc/init.d/nrpe start  
   
 running?  
   
 # netstat -an |grep 5666  
 tcp    0   0 0.0.0.0:5666      0.0.0.0:*        LISTEN  
 tcp6    0   0 :::5666         :::*          LISTEN  
   
 check if npre is accessible. the rev show show up.   
 # /usr/local/nagios/libexec/check_nrpe -H localhost   
  NRPE v2.15   
    
make it easy on yourself with a script as opposed to copy/paste.
 useradd -c "nagios system user" -d /usr/local/nagios -m nagios ;  
 chown nagios:nagios /usr/local/nagios ;  
 mkdir -p /usr/local/src ;  
 cd /usr/local/src ;  
 scp you@somewhere:/dir/nrpe-2.15.tar.gz . ;  
 scp you@somewhere:/dir/nagios-plugins-1.4.16.tar.gz . ;  
 scp you@somewhere:/dir/templates/* . ;  
 gunzip nrpe-2.15.tar.gz ;  
 tar xvf nrpe-2.15.tar ;  
 gunzip nagios-plugins-1.4.16.tar.gz ;  
 tar xvf nagios-plugins-1.4.16.tar ;  
 cd nrpe-2.15 ;  
 ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu ;  
 make && make install ;  
 make install-daemon-config ;  
 cd ../nagios-plugins-1.4.16 ;  
 ./configure --without-mysql ;  
 make && make install ;  
 cp /usr/local/src/nrpe.cfg /usr/local/nagios/etc/ ;  
 echo 'nrpe 5666/tcp # NRPE' >> /etc/services ;  
 cp /usr/local/src/nrpe-2.15/init-script.debian /etc/init.d/nrpe ;  
 chmod +x /etc/init.d/nrpe  
   
 common prereqs:  
   
 libssl-dev  
 apt-file  
 sysv-rc-conf  
   
 note:  
 if you see the make error in npre section (make will not tell you, you have to watch the process):  
 ./nrpe.c:269: undefined reference to `get_dh512'  
   
 a hint is when you rn /etc/init.d/nrpe and do not see the output:  
 Starting nagios remote plugin daemon: nrpe.  
   
 edit dh.h with C-code output if openssl is installed.  
 # openssl dhcparam -C 512 > /usr/local/src/nrpe-2.15/include/dh.h  
 and removing all between:  
 -----BEGIN DH PARAMETERS-----  
 -----END DH PARAMETERS-----  
   
 if running openssl comes up as not found,  
 apt-get install openssl  
   
   
 for ubuntu 10 and lower:  
 --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib   
   
 if you do not want to roll your own:  
 apt-get install nagios-nrpe-server  
 apt-get install nagios-plugins  
 apt-get install nagios-plugins-basic  
 apt-get install nagios-plugins-standard  
   
 all the conf stuff resides in:  
 /etc/nagios

...
a basic-o-rama template (npre.cfg):

#############################################################################
# NRPE Config File
# 
# Last Modified: TODAY!
#############################################################################


# LOG FACILITY
log_facility=daemon

# PID FILE
pid_file=/var/run/nrpe.pid

# PORT NUMBER
server_port=5666

# SERVER ADDRESS
#server_address=127.0.0.1

# NRPE USER
nrpe_user=nagios

# NRPE GROUP
nrpe_group=nagios

# ALLOWED HOST ADDRESSES
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
# losthost and monitoring servers
allowed_hosts=127.0.0.1,128.6.6.6,10.5.5.5

# COMMAND ARGUMENT PROCESSING
dont_blame_nrpe=0

# BASH COMMAND SUBTITUTION
allow_bash_command_substitution=0

# DEBUGGING OPTION
# Values: 0=debugging off, 1=debugging on
debug=0

# COMMAND TIMEOUT
command_timeout=60

# COMMAND DEFINITIONS
# The following examples use hardcoded command arguments...

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 600 -c 900

 

Tuesday, November 29, 2016

check_vmware_api.pl install is perl hell

 Prerequisites:  
 - Ubuntu 14.04 Server (perl v5.18.2)  
 - VMware-vSphere-Perl-SDK-5.5.0-2043780  
 - check_vmware_api.pl 0.7.1  
   
 Basic installation:  
   
 apt-get install perl-doc libssl-dev libxml-libxml-perl libarchive-zip-perl libcrypt-ssleay-perl libclass-methodmaker-perl libuuid-perl libdata-dump-perl libsoap-lite-perl libio-compress-perl  
 tar -xf VMware-vSphere-Perl-SDK-5.5.0-2043780.x86_64.tar.gz -C /tmp  
 cd /tmp/vmware-vsphere-cli-distrib  
 ./vmware-install.pl  
   
 ...  

 cpan[3]> i /libwww-perl/  
 Distribution  GAAS/libwww-perl-5.837.tar.gz  
 Distribution  GAAS/libwww-perl-6.01.tar.gz  
 Distribution  GAAS/libwww-perl-6.05.tar.gz  
 Author     LWWWP ("The libwww-perl mailing list" <libwww@perl.org>)  
 4 items found  
    
 cpan[4]> install GAAS/libwww-perl-5.837.tar.gz  
 Running make for G/GA/GAAS/libwww-perl-5.837.tar.gz  
 Checksum for /root/.cpan/sources/authors/id/G/GA/GAAS/libwww-perl-5.837.tar.gz ok  
   
 ...  
   
 http://search.cpan.org/dist/Nagios-Plugin/lib/Nagios/Plugin.pm  
 Nagios::Monitoring::Plugin  
   
 Nagios::Plugin <- no longer  
   
 ...  

 Work around for "Server version unavailable":  
   
 patch -b /usr/share/perl/5.14/VMware/VICommon.pm new(agent => "VI Perl");  
 + $user_agent->ssl_opts( SSL_verify_mode => 0 );  
 my $cookie_jar = HTTP::Cookies->new(ignore_discard => 1);  
 $user_agent->cookie_jar($cookie_jar);  
 $user_agent->protocols_allowed(['http', 'https']);  
 @@ -502,7 +503,7 @@  
 sub query_server_version {  
 BEGIN {  
 #To remove SSL Warning, switching from IO::Socket::SSL to Net::SSL  
 - $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL";  
 + #$ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL";  
 #To remove host verification  
 $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;  
 }  
 @@ -526,6 +527,7 @@  
 }  
 }  
 my $user_agent = LWP::UserAgent->new(agent => "VI Perl");  
 + $user_agent->ssl_opts( SSL_verify_mode => 0 );  
 my $cookie_jar = HTTP::Cookies->new(ignore_discard => 1);  
 $user_agent->cookie_jar($cookie_jar);  
 $user_agent->protocols_allowed(['http', 'https']);  
 @@ -2108,6 +2110,7 @@  
 sub new {  
 my ($class, $url) = @_;  
 my $user_agent = LWP::UserAgent->new(agent => "VI Perl");  
 + $user_agent->ssl_opts( SSL_verify_mode => 0 );  
 my $cookie_jar = HTTP::Cookies->new(ignore_discard => 1);  
 $user_agent->cookie_jar( $cookie_jar );  
 $user_agent->protocols_allowed( ['http', 'https'] );  
 *****************************************************************  
 
...  
   
 env -i perl -V  
   
 @INC is yucky.  
   
 command execution via _compile function in Maketext.pm  
  Built under linux  
  Compiled at Feb 4 2014 23:11:19  
  @INC:  
   /etc/perl  
   /usr/local/lib/perl/5.14.2  
   /usr/local/share/perl/5.14.2  
   /usr/lib/perl5  
   /usr/share/perl5  
   /usr/lib/perl/5.14  
   /usr/share/perl/5.14  
   /usr/local/lib/site_perl  
   
 All my new stuff is under /usr/local/lib/perl5/  
 and not /usr/local/lib/site_perl oh come on.  
   
 because   
 Can't locate Monitoring/Plugin/Functions.pm   
 find / | grep -i Functions.pm <- in 5.18.0  
   
 ln -s /usr/local/lib/perl5/site_perl/5.18.0 site_perl  
   
 because  
 Can't locate Params/Validate.pm   
 find / | grep -i Validate.pm <- in 5.24.0  
   
 cd /usr/local/lib/site_perl/Params  
   
 ln -s /usr/local/lib/perl5/site_perl/5.24.0/x86_64-linux/Params/Validate .  
 ln -s /usr/local/lib/perl5/site_perl/5.24.0/x86_64-linux/Params/Validate.pm .  
 ln -s /usr/local/lib/perl5/site_perl/5.24.0/x86_64-linux/Params/ValidatePP.pm .  
 ln -s /usr/local/lib/perl5/site_perl/5.24.0/x86_64-linux/Params/ValidateXS.pm .  

Wednesday, November 16, 2016

setting a static address in alom

    
 for whatever reason my alom network settings were not picking up dhcp.  
 that's okay. let's set a static address. 

 many sun servers, by the way, do not have scadm in the platform directory...
 yeah. try it:
 /usr/platform/`uname -i`/sbin/scadm  
  
 get to a service console via a serial connection, logon and issue:  
   
 setsc netsc_dhcp false  
 setsc netsc_ipaddr <ip address>  
 setsc netsc_ipnetmask <subnet mask>  
 setsc netsc_ipgateway <gateway address>  
   
 shownetwork <- is useless until you have issued resetsc -y  
   
 reset the alom to effect settings:  
   
 resetsc -y  

Wednesday, November 9, 2016

ilom i heart you

  
 i heart you when the solaris system doesn't autoboot  
   
 -> start /SYS  
 -> start /SP/console  
   
 do evil much evil  
   
 #.  

Wednesday, November 2, 2016

compile and install nagios nrpe 2.15 on solaris 10 sparc

 compile and install nagios nrpe 2.15 on solaris 10 sparc  
   
 # useradd -c "nagios system user" -d /usr/local/nagios -m nagios  
 # groupadd nagios  
 add nagios user to nagios group  
   
 # chown nagios:nagios /usr/local/nagios/  
 # cd /usr/local/src  
 # wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz  
 # wget --no-check-certificate https://nagios-plugins.org/download/nagios-plugins-1.4.11.tar.gz  
   
 compile and install nrpe   
 # gunzip nrpe-2.15.tar.gz  
 # tar xvf nrpe-2.15.tar  
 # cd nrpe-2.15  
 # ./configure  
 # make && make install  
 # make install-daemon-config  
   
 compile and install plugins  
 # gunzip nagios-plugins-1.4.11.tar.gz  
 # tar xvf nagios-plugins-1.4.11.tar  
 # cd nagios-plugins-1.4.11  
 # ./configure --without-mysql  
 # make && make install  
   
 set up nrpe  
 # cat nrpe 5666/tcp # NRPE >> /etc/services  
   
 # cat nrpe stream tcp nowait nagios \  
 /usr/sfw/sbin/tcpd /usr/local/nagios/bin/nrpe -c \  
 /usr/local/nagios/etc/nrpe.cfg -i >> nrpe stream tcp nowait nagios \  
 /usr/sfw/sbin/tcpd /usr/local/nagios/bin/nrpe -c \  
 /usr/local/nagios/etc/nrpe.cfg -i  
 
 in /etc/inetd.conf add:
 nrpe stream tcp nowait nagios /usr/sfw/sbin/tcpd /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -i

  
 convert inetd to smf  
 # inetconv  
  nrpe -> /var/svc/manifest/network/nrpe-tcp.xml  
  Importing nrpe-tcp.xml …Done  
   
 did it work?  
 # inetconv -e  
  svc:/network/nrpe/tcp:default enabled  
   
 online?  
 # svcs svc:/network/nrpe/tcp:default  
 STATE STIME FMRI  
 online 15:49:55 svc:/network/nrpe/tcp:default  
 
# netstat -a | grep nrpe  
 *.nrpe *.* 0 0 49152 0 LISTEN  
   
   
 look at npre.cfg on client  
 first, add the host and the servers that may access it.  
   
 restart the service  
 # svcadm disable svc:/network/nrpe/tcp:default  
 # svcadm enable svc:/network/nrpe/tcp:default  
   
 check if npre is accessible. the rev show show up.  
 # /usr/local/nagios/libexec/check_nrpe -H localhost  
  NRPE v2.15  
   
 problems?  
 # ldd /usr/local/nagios/bin/nrpe <- missing libs?  
 # less /var/svc/log/network-nrpe:default.log <- logs  
   
 and then on the nagios server itself, match the   
 services with what is defined in npre.cfg  
   
 solaris npre plugins look like:  
   
 command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10  
 command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20  
 command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /  
 command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z  
 command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200  
   
 note: check_hda1. usually / is defined as /dev/hda1 ; this is not match  
 the entry in /etc/vfstab . is the system is global root zone for zones  
 check_procs will need to be edited. change it to something insane like  
 100 for every zone. it is 150 200, by default.  
   
 
 define service {  
     host_name            sparc01  
     service_description       Root Partition  
     check_command          check_nrpe!check_hda1  
     use               generic-service  
     }  
   
 define service {  
     host_name            sparc01  
     service_description       Current Users  
     check_command          check_nrpe!check_users  
     use               generic-service  
     }  
   
 define service {  
     host_name            sparc01  
     service_description       CPU Load  
     check_command          check_nrpe!check_load  
     use               generic-service  
     }  
   
 define service {  
     host_name            sparc01  
     service_description       Total Processes  
     check_command          check_nrpe!check_total_procs  
     use               generic-service  
     }  
   
 define service {  
     host_name            sparc01  
     service_description       Zombie Processes  
     check_command          check_nrpe!check_zombie_procs  
     use               generic-service  
     }  
   

high contrast happened

 i walked away from my terminal. evil happened.

 evil no more!  
   
 rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:"C:\Windows\Resources\Ease of Access Themes\classic.theme"