Showing posts with label monitor_server. Show all posts
Showing posts with label monitor_server. Show all posts

2014/12/01

Nagios monitor ESX server

1.install vSphere Perl SDK for vSphere
http://communities.vmware.com/community/developer/forums/vsphere_sdk_perl

2.download perl
http://exchange.nagios.org/directory/Plugins/Operating-Systems/*-Virtual-Environments/VMWare/Vmware-ESX-%26-VM-host/details

3./check_esx3.pl -D 192.168.1.1 -u root -p password -l vmfs

/check_esx3.pl --help
check_esx3.pl 0.5.0

This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY.
It may be used, redistributed and/or modified under the terms of the GNU
General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt).

VMWare Infrastructure plugin

Usage: check_esx3.pl -D | -H [ -N ]
    -u -p | -f
    -l [ -s ]
    [ -x ] [ -o ]
    [ -t ] [ -w ] [ -c ]
    [ -V ] [ -h ]

 -?, --usage
   Print usage information
 -h, --help
   Print detailed help screen
 -V, --version
   Print version information
 --extra-opts=[section][@file]
   Read options from an ini file. See http://nagiosplugins.org/extra-opts
   for usage and examples.
 -H, --host=
   ESX or ESXi hostname.
 -C, --cluster=
   ESX or ESXi clustername.
 -D, --datacenter=
   Datacenter hostname.
 -N, --name=
   Virtual machine name.
 -u, --username=
   Username to connect with.
 -p, --password=
   Password to use with the username.
 -f, --authfile=
   Authentication file with login and password. File syntax :
   username=
   password=
 -w, --warning=THRESHOLD
   Warning threshold. See
   http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT
   for the threshold format.
 -c, --critical=THRESHOLD
   Critical threshold. See
   http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT
   for the threshold format.
 -l, --command=COMMAND
   Specify command type (CPU, MEM, NET, IO, VMFS, RUNTIME, ...)
 -s, --subcommand=SUBCOMMAND
   Specify subcommand
 -S, --sessionfile=SESSIONFILE
   Specify a filename to store sessions for faster authentication
 -x, --exclude=
   Specify black list
 -o, --options=
   Specify additional command options
 -t, --timeout=INTEGER
   Seconds before plugin times out (default: 30)
 -v, --verbose
   Show details for command-line debugging (can repeat up to 3 times)
Supported commands(^ means blank or not specified parameter) :
    Common options for VM, Host and DC :
        * cpu - shows cpu info
            + usage - CPU usage in percentage
            + usagemhz - CPU usage in MHz
            ^ all cpu info
        * mem - shows mem info
            + usage - mem usage in percentage
            + usagemb - mem usage in MB
            + swap - swap mem usage in MB
            + overhead - additional mem used by VM Server in MB
            + overall - overall mem used by VM Server in MB
            + memctl - mem used by VM memory control driver(vmmemctl) that controls ballooning
            ^ all mem info
        * net - shows net info
            + usage - overall network usage in KBps(Kilobytes per Second)
            + receive - receive in KBps(Kilobytes per Second)
            + send - send in KBps(Kilobytes per Second)
            ^ all net info
        * io - shows disk io info
            + read - read latency in ms (totalReadLatency.average)
            + write - write latency in ms (totalWriteLatency.average)
            ^ all disk io info
        * runtime - shows runtime info
            + status - overall host status (gray/green/red/yellow)
            + issues - all issues for the host
            ^ all runtime info
    VM specific :
        * cpu - shows cpu info
            + wait - CPU wait time in ms
            + ready - CPU ready time in ms
        * mem - shows mem info
            + swapin - swapin mem usage in MB
            + swapout - swapout mem usage in MB
            + active - active mem usage in MB
        * io - shows disk I/O info
            + usage - overall disk usage in MB/s
        * runtime - shows runtime info
            + con - connection state
            + cpu - allocated CPU in MHz
            + mem - allocated mem in MB
            + state - virtual machine state (UP, DOWN, SUSPENDED)
            + consoleconnections - console connections to VM
            + guest - guest OS status, needs VMware Tools
            + tools - VMWare Tools status
    Host specific :
        * net - shows net info
            + nic - makes sure all active NICs are plugged in
        * io - shows disk io info
            + aborted - aborted commands count
            + resets - bus resets count
            + kernel - kernel latency in ms
            + device - device latency in ms
            + queue - queue latency in ms
        * vmfs - shows Datastore info
            + (name) - free space info for datastore with name (name)
            ^ all datastore info
        * runtime - shows runtime info
            + con - connection state
            + health - checks cpu/storage/memory/sensor status
            + maintenance - shows whether host is in maintenance mode
            + list(vm) - list of VMWare machines and their statuses
        * service - shows Host service info
            + (names) - check the state of one or several services specified by (names), syntax for (names):,,...,
            ^ show all services
        * storage - shows Host storage info
            + adapter - list bus adapters
            + lun - list SCSI logical units
            + path - list logical unit paths
    DC specific :
        * io - shows disk io info
            + aborted - aborted commands count
            + resets - bus resets count
            + kernel - kernel latency in ms
            + device - device latency in ms
            + queue - queue latency in ms
        * vmfs - shows Datastore info
            + (name) - free space info for datastore with name (name)
            ^ all datastore info
        * runtime - shows runtime info
            + list(vm) - list of VMWare machines and their statuses
            + listhost - list of VMWare esx host servers and their statuses
            + tools - VMWare Tools status
        * recommendations - shows recommendations for cluster
            + (name) - recommendations for cluster with name (name)
            ^ all clusters recommendations

2014/02/13

smokeping (v2.6.9) install CentOS 6

Download from http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz

yum install perl cpan rrdtool-perl gcc gcc-c++
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
tar zxvf smokeping-2.6.9.tar.gz
cd smokeping-2.6.9
./configure
##--install lost perl--with--
##perl -MCPAN -e 'install "the perl u need to install'
./setup/build-perl-modules.sh /usr/local/smokeping-2.6.9/thirdparty
./configure --prefix=/usr/local/smokeping
make ; make install
## install fping

wget http://fping.sourceforge.net/download/fping.tar.gz
tar zxvf fping.tar.gz
cd fping-2.4b2_to/
./configure
make ; make install

##Make dir

mkdir -p /usr/local/smokeping/cache
mkdir -p /usr/local/smokeping/data
##cp /usr/local/smokeping/htdocs/smokeping.fcgi.dist  /usr/local/smokeping/htdocs/smokeping.fcgi

## Edit config

cp  /usr/local/smokeping/etc/config.dist /usr/local/smokeping/etc/config
vi /usr/local/smokeping/etc/config

## Start up

/usr/local/smokeping/bin/smokeping start
/usr/local/smokeping/bin/smokeping --reload
/usr/local/smokeping/bin/smokeping --restart
/usr/local/smokeping/bin/smokeping --debug
/usr/local/smokeping/bin/smokeping --check


## http server

vi /etc/httpd/conf.d/smokeping.conf   

----
ScriptAlias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi.dist"

alias /cache "/usr/local/smokeping/cache"



AllowOverride None

AddHandler cgi-script cgi

Options ExecCGI
 

----

service httpd reload





2014/01/23

Cacti install spine

1.download spine

wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8b.tar.gz
tar xvf cacti-spine-0.8.8b.tar.gz
cd cacti-spine-0.8.8b

2.install

./configure && make && make install
cp spine.conf.dist /etc/spine.conf


3.edit mysql login user

vi  /etc/spine.conf



2013/12/17

nagios install

 useradd nagios
 wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.2.tar.gz
 wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
 tar xfv nagios-4.0.2.tar.gz
 tar xvf nagios-plugins-1.5.tar.gz
 cd nagios-4.0.2
 ./configure --prefix=/usr/local/nagios
 make ; make all ; make install
 make install-init
 make install-config
 cd ../nagios-plugins-1.5
 ./configure --prefix=/usr/local/nagios && make all && make install

-- for nagios map --

yum install gd gd-devel

make clean
 ./configure --prefix=/usr/local/nagios --with-gd-lib=/usr/lib   --with-gd-inc=/usr/include
 ./configure --with-command-group=nagcmd
 make all; make install; make install-init; make install-config; make install-commandmode; make install-webconf 

-- for mail command --

yum install mailx


-- for perl --
yum -y install perl-Params-Validate perl-Math-Calc-Units perl-Regexp-Commonperl-Class-Accessor perl-Config-Tiny perl-Nagios-Plugin.noarch

2013/11/06

Basic Apache 2.4.6 PHP 5.5.4

## Basic

yum install gcc libtool make automake autoconf curl-devel gd-devel openssl-devel gcc-c++ libmcrypt-devel libevent-devel posgresql-devel cronolog libtool-ltdl-devel

## Apache apr

wget http://ftp.twaren.net/Unix/Web/apache//apr/apr-1.4.8.tar.gz

tar xf apr-1.4.8.tar.gz
cd apr-1.4.8
./configure
make ; make install

## Apache apr-util

wget http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz

tar xf apr-util-1.5.2.tar.gz
cd apr-util-1.5.2
./configure --with-apr=/usr/local/apr/bin/apr-1-config
make ; make install


wget  http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.zip
unzip pcre-8.33.zip
cd pcre-8.33
./configure
make ; make install

## Apache

wget http://archive.apache.org/dist/httpd/httpd-2.4.6.tar.gz
tar xf httpd-2.4.6.tar.gz
cd httpd-2.4.6
./configure --prefix=/usr/local/apache2
make ; make install

## PHP 5.5.4

yum -y install libxml2 libxml2-devel
wget http://tw2.php.net/get/php-5.5.4.tar.gz/from/this/mirror
tar -xf php-5.5.4.tar.gz
cd php-5.5.4
./configure  --prefix=/usr/local/apache2/php
make ; make install

##
cd /usr/local/bin ; ln -s /usr/local/apache2/php/bin/php ; ln -s /usr/local/apache2/php/bin/phpize ; ln -s /usr/local/apache2/php/bin/php-config

touch /usr/local/apache2/conf/php.ini

##
echo "AddType application/x-httpd-php .php" >> /usr/local/apache2/conf/httpd.conf
echo "AddType application/x-httpd-php-source .phps" >> /usr/local/apache2/conf/httpd.conf

2012/11/23

Cacti install note

0.
yum install -y httpd php php-mysql php-snmp php-xml mysql mysql-server cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel net-snmp-utils gcc wget man make perl-CPAN perl-ExtUtils-MakeMaker perl-ExtUtils-MakeMaker-Coverage crontabs xorg-x11-fonts-100dpi xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi ntp php-gd rrdtool

1.


fc-cache -vfs
mysqladmin --user=root password mypassword
mysqladmin --user=root --password reload

# Install and Configure Cacti
mkdir -p /var/www/html/cacti
cd /var/www/html/
wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz
tar zxvf cacti-0.8.8a.tar.gz
mv cacti-0.8.8a cacti
cd cacti
cd /var/www/html/cacti/cacti-0.8.8a

2.
service mysqld start
chkconfig mysqld on

#import Cacti SQL
mysqladmin -u root -p  mypassword create cacti
mysql -u root -pmypassword cacti < cacti.sql
mysql -u root -pmypassword

# MySQL command
mysql> GRANT ALL ON cacti.* TO admin@localhost IDENTIFIED BY 'adminpassword';
mysql> flush privileges;


3.

更改config.php成我們MySQL的username, password與url path,如下:

vi include/config.php
$database_username = "admin";
$database_password = "adminpassword";
$url_path = "/cacti/";

4.

更改目錄權限
chown -R apache:apache /var/www/html/cacti
chown -R admin /var/www/html/cacti/rra/ /var/www/html/cacti/log/

5.

crontab -e
*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1

service crond restart
service httpd start
chkconfig httpd on