2014/11/06

ESXi 5.x snmp setting

0. download and install  VMware vSphere CLI 5.0 and turn on cmd


1.

cd "C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\"

2.

vicfg-snmp.pl --server 192.168.200.212 --username root --password password --c public

3.

vicfg-snmp.pl --server 192.168.200.212  --username root --password password --enable

4.

vicfg-snmp.pl --server 192.168.200.212  --username root --password password  --show

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/12/12

Convert a VMX to an OVF
ovftool f:/myvms/BigDemo.vmx x:/ovf/BigDemo.ovf


Convert a VMX to an OVA
ovftool vmxs/Nostalgia.vmx ovfs/Nostalgia.ova


Convert an OVF to a VMX
ovftool BigDemo.ovf x:/myvms/BigDemo.vmx

2013/12/11

send from Linux with file

yum -y install mutt mailx

echo "This is backup" | mutt -a "/backup/2013-12-11-10:59:09.tgz" -s "Master *** backup" --wtf@mail.mail

2013/12/03

bashrc







# .bashrc
export PS1='\[\033[01;32m\][`date +%T`]\[\033[01;31m\][\u@\h]\[\033[00m\] \w \$'

# User specific aliases and functions
alias ll='ls -lah'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ls='ls --color'
alias today="date '+%F week %u'"
alias bye='history -c;exit'
alias zhutf8='setenv LC_ALL zh_TW.utf8;setenv LANG zh_TW.utf8'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi


2013/11/29

建立SSL使用憑證

##建立SSL使用憑證
mkdir -p /ssl/
cd /ssl
openssl genrsa -out privatekey.pem 2048
openssl req -new -key privatekey.pem -out  certerq.csr

openssl x509 -req -days 3650 -in certerq.csr -signkey privatekey.pem -out cert.pem

openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -out /ssl/apache2/apache.crt -keyout /ssl/apache2/apache.key

shell for Backup

#!/bin/bash
day=`date +%Y-%m-%d-%T`
backupph=/backup/$day
mkdir -p $backupph
cp -a /var/named/chroot/ $backupph
echo "Backup Finish"



------


#!/bin/bash
day=`date +%Y-%m-%d`
backupph=/media/disk/$day
mkdir $backupph
tar -czvfP $backupph/home.tgz /home
echo "Backup Finish"



TAR


tar -xzvPf filename

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