You need to install the following package….

sudo apt-get install flashplugin-nonfree

Restart Firefox and presto!

 
root@donkey:/tmp#
for file in $(ls -la ./ | awk '{print $8}'); do
mv $file $( echo $file | awk '{print tolower($0)}');
done;

root@donkey:/tmp# ls
keyring-hs5u3c mozilla-media-cache mu3gbhjz muszpyya orbit-jjest orbit-root virtual-root.mvfgzj

root@donkey:/tmp#
for file in $(ls -la ./ | awk '{print $8}');
do mv $file $( echo $file | awk '{print toupper($0)}');
done;

mv: `.’ and `./.’ are the same file
mv: cannot remove `..’: Is a directory

root@donkey:/tmp# ls
KEYRING-HS5U3C MOZILLA-MEDIA-CACHE MU3GBHJZ MUSZPYYA ORBIT-JJEST ORBIT-ROOT VIRTUAL-ROOT.MVFGZJ

 

Before you begin take a backup copy of the following files in case you have to set them back to a working state.

/etc/sysconfig/network-scripts/ifcfg-eth1
/etc/sysconfig/network-scripts/ifcfg-eth2
/etc/modprobe.conf

Create a new file /etc/sysconfig/network-scripts/ifcfg-bond0 and add the following to it, using your own ip addresses

DEVICE=bond0
IPADDR=x.x.x.x
NETWORK=y.y.y.y
NETMASK=z.z.z.z
USERCTL=no
BOOTPROTO=none
ONBOOT=yes

Modify your /etc/sysconfig/network-scripts/ifcfg-eth1 file and change it to

DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

Also modify your /etc/sysconfig/network-scripts/ifcfg-eth2 file and change it to

DEVICE=eth2
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

Save all of these files.

Add the following lines to the end of /etc/modprobe.conf

alias bond0 bonding
options bond0 mode=0 miimon=1000

Make sure the bonding module is loaded with

modprobe bonding

Then restart the network service

service network resart

You should now see the bond0 nic listed if you run and ifconfig from the command line. Test with less /proc/net/bonding/bond0

Source:

http://itfixed.blogspot.com/2009/02/itfixed-it-for-me-nic-bonding-on-linux.html

http://www.cyberciti.biz/tips/linux-bond-or-team-multiple-network-interfaces-nic-into-single-interface.html

 

INSTALL on RHEL6

1.Archive to use for RHEL6.

[root@lange ~]# scp monk:/root/scripts/OM-*6.5* .
OM-SrvAdmin-Dell-Web-LX-6.5.0-2247.RHEL6.x86_64_A01.5.tar.gz 100% 105MB 35.0MB/s 00:03

2.Required libraries are in yum repo.

yum install sblim-sfcb sblim-sfcc opensman-server opensman-client

3.Run ./srvadmin-install.sh –express

INSTALL on RHEL 5

[root@lange ~]# wget -q -O – http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash

INSTALL SRVADMIN TOOLS

[root@lange ~]# yum install srvadmin-all

START THE SERVICE

[root@lange srvadmin]# bash /opt/dell/srvadmin/sbin/srvadmin-services.sh start
Starting Systems Management Device Drivers:
Starting dell_rbu: [ OK ]
Starting ipmi driver: Already started [ OK ]
Starting Systems Management Data Engine:
Starting dsm_sa_datamgrd: [ OK ]
Starting dsm_sa_eventmgrd: [ OK ]
Starting dsm_sa_snmpd: [ OK ]
Starting DSM SA Shared Services: [ OK ]

Starting DSM SA Connection Service: [ OK ]

 

SVN GUID TO UPDATING RSYNC SCRIPT
-sync repository

$ svn update

-edit files in /root/svn/

-commit changes to repository

[root@jackson svn]# svn commit -m ‘added header publisher notes’
Sending jackson_rsync.py
Transmitting file data .
Committed revision 4.

-copy to live destination

[root@jackson svn]# svnlive
building file list … done
jackson_rsync.py

sent 4532 bytes received 42 bytes 9148.00 bytes/sec
total size is 4427 speedup is 0.97

-SVN local file and production file are now the same version.

[root@jackson svn]# diff /root/svn/jackson_rsync.py /usr/local/jackson_rsync.py

CHECK CHANGES BETWEEN REVISIONS FOR SINGLE FILE

[root@donuts svn]# svn -r 1:6 diff ngs_archive.py
Index: ngs_archive.py
===================================================================
— ngs_archive.py (revision 1)
+++ ngs_archive.py (revision 6)
@@ -40,8 +40,7 @@

#globals vars
-#source_dest_path={‘/vol20/ngsData/runs/’:'/vol20-backup/’,'/vol10/ngsData/runs/’:'/vol10-backup/’}
-source_dest_path={‘/vol20/ngsData/runs/’:'/vol05/ngsBackup/’,'/vol10/ngsData/runs/’:'/vol05/ngsBackup/’}
+source_dest_path={‘/vol10/ngsData/runs/’:'/vol05/ngsBackup/’}
run_type=”
backup_file=”
disk_space_threshold=100 #max percent full before script will delete old archives.

VIEW CHANGE LOG FOR FILE

[root@donuts svn]# svn log ngs_archive.py
————————————————————————
r6 | jjest | 2011-07-06 10:51:08 -0700 (Wed, 06 Jul 2011) | 1 line

altered source path
————————————————————————
r1 | root | 2011-06-29 13:54:47 -0700 (Wed, 29 Jun 2011) | 1 line

SVN HOWTO GUID

[root@monk ~]# svnadmin create /root/svn
[root@monk ~]# vi /root/svn/
conf/ db/ format hooks/ locks/ README.txt
[root@monk ~]# vi /root/svn/
conf/ db/ format hooks/ locks/ README.txt
[root@monk ~]# vi /root/svn/conf/svnserve.conf
[root@monk ~]# vi /root/svn/conf/passwd
[root@monk ~]# svn import /root/scripts file:///root/svn/scripts
svn: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the –message (-m) or –file (-ns
svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no ‘editor-cmd’ run-time configuration option was found
[root@monk ~]# echo $EDITOR

[root@monk ~]# echo EDITOR
EDITOR
[root@monk ~]# $EDITOR=/bin/vi
-bash: =/bin/vi: No such file or directory
[root@monk ~]# which vi
alias vi=’vim’
/usr/bin/vim
[root@monk ~]# $EDITOR=/usr/bin/vim
-bash: =/usr/bin/vim: No such file or directory
[root@monk ~]# $EDITOR=’/usr/bin/vim’
-bash: =/usr/bin/vim: No such file or directory
[root@monk ~]# SVN_EDITOR=’/usr/bin/vim’
[root@monk ~]# echo $SVN_EDITOR
/usr/bin/vim
[root@monk ~]# svn import /root/scripts file:///root/svn/scripts
svn: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the –message (-m) or –file (-ns
svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no ‘editor-cmd’ run-time configuration option was found
[root@monk ~]# export SVN_EDITOR
[root@monk ~]# svn import /root/scripts file:///root/svn/scripts

Log message unchanged or not specified
(a)bort, (c)ontinue, (e)dit:
c
Adding /root/scripts/ngs_archive.py
Adding (bin) /root/scripts/OM-SrvAdmin-Dell-Web-LX-6.5.0-2247_A01.15.tar
Adding /root/scripts/managelinks.py
Adding /root/scripts/.bashrc
Adding /root/scripts/lab_pc_backup_script.py
Adding /root/scripts/10.200.80.148
Adding /root/scripts/configScript.py
Adding /root/scripts/check_perc_fw
Adding /root/scripts/server-stats-path.py
Adding (bin) /root/scripts/VMwareTools-4.0.0-236512.tar.gz
Adding /root/scripts/check_bacula
Adding /root/scripts/drvault_rsync.py
Adding /root/scripts/scp-scripts-old
Adding /root/scripts/scp-scripts-old/scp_nrpe.py
Adding /root/scripts/scp-scripts-old/scp_check_perc.py
Adding /root/scripts/scp-scripts-old/scp_auth_keys.py
Adding /root/scripts/server-stats.py
Adding (bin) /root/scripts/OM-SrvAdmin-Dell-Web-LX-6.5.0-2247.RHEL6.x86_64_A01.5.tar.gz
Adding /root/scripts/vol20_backup-dev.py
Adding /root/scripts/biovault_rsync.py
Adding (bin) /root/scripts/LIVEServer-5.0-124.rhel4.i386.rpm
Adding /root/scripts/jackson_rsync.py
Adding /root/scripts/yum.conf
Adding /root/scripts/check_uptime
Adding /root/scripts/check_bandwidth
Adding /root/scripts/bashrc
Adding /root/scripts/nrpe.cfg
Adding /root/scripts/check_lab_backups
Adding /root/scripts/drvault-fw.sh
Adding t/scripts/check_omreport
Adding /root/scripts/check_memory
Adding /root/scripts/jacksonFstab
Adding /root/scripts/bacula_label_tapes.py
Adding (bin) /root/scripts/barracuda-ysb-8.9.01.60604-lin.tgz
Adding /root/scripts/scp_file.py
Adding /root/scripts/bv-mdadm.conf
Adding /root/scripts/vol20_backup.py
Adding (bin) /root/scripts/OM-MgmtStat-Dell-Web-LX-6.4.0-1401_A01.tar.gz
Adding /root/scripts/check_mdadm
Adding /root/scripts/check_cpu
Adding /root/scripts/addNewUserGroup.sh
Adding /root/scripts/check_124t
Adding /root/scripts/check_ipmi
Adding (bin) /root/scripts/LIVEServer-5.0-110.rhel5.x86_64.rpm
Adding /root/scripts/nrpe-restart.sh
Adding /root/scripts/profile
Adding /root/scripts/check_oracle
Adding /root/scripts/yum-update.sh
….

start svn as daemon

[root@monk ~]# svnserve -d
[root@monk ~]# ps -ef | grep svnserve
root 13568 1 0 14:01 ? 00:00:00 svnserve -d
root 13570 11352 0 14:01 pts/3 00:00:00 grep svnserve

from client

[root@jackson svn]# svn list svn://monk/root/svn/
scripts/

checkout

[root@jackson ~]# mkdir svn
[root@jackson ~]# svn co svn://monk/root/svn/scripts/ ./svn/
A svn/ngs_archive.py
A svn/.bashrc

commite changes

[root@jackson ~]# svn commit -m ‘remove bin files’ ./svn
Authentication realm: 0cffdcf6-4895-4db7-98f9-fe71682a2229
Password for ‘jjest’:

———————————————————————–
ATTENTION! Your password for authentication realm:

0cffdcf6-4895-4db7-98f9-fe71682a2229

can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the ‘store-plaintext-passwords’ option to either ‘yes’ or ‘no’ in
‘/root/.subversion/servers’.
———————————————————————–
Store password unencrypted (yes/no)? yes
Deleting svn/LIVEServer-5.0-110.rhel5.x86_64.rpm
Deleting svn/LIVEServer-5.0-124.rhel4.i386.rpm
Deleting svn/OM-MgmtStat-Dell-Web-LX-6.4.0-1401_A01.tar.gz
Deleting svn/OM-SrvAdmin-Dell-Web-LX-6.5.0-2247.RHEL6.x86_64_A01.5.tar.gz
Deleting svn/OM-SrvAdmin-Dell-Web-LX-6.5.0-2247_A01.15.tar
Deleting svn/OMI-SrvAdmin-Dell-Web-LX-620-677.rhel5.tar
Deleting svn/VMwareTools-4.0.0-236512.tar.gz
Deleting svn/barracuda-ysb-8.9.01.60604-lin.tgz
Deleting svn/nagios-server-backup-1-31-11.tar
Deleting svn/zlib-1.2.5.tar.gz
Committed revision 2.

ref: http://www.tonyspencer.com/2007/03/02/setup-a-subversion-server-in-4-minutes/

 

Installing Grub onto both MBRs
Since the /boot partition is a RAID, grub cannot read it to get the bootloader. It can only access physical drives. Thus, you still use (hd0,0) in this step.

Run grub:

shaggy# grub
You must see GRUB prompt:

grub>

If you are using a RAID 1 mirror disk system, you will want to install grub on all the disks in the system, so that when one disk fails, you are still able to boot. The find command above will list the disks, e.g.

grub> find /boot/grub/stage1
(hd0,0)
(hd1,0)
grub>
Now, if your disks are /dev/sda and /dev/sdb, do the following to install GRUB on /dev/sda MBR:

device (hd0) /dev/sda
root (hd0,0)
setup (hd0)

This will install grub into the /dev/sdb MBR:

device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)

The device command tells grub to assume the drive is (hd0), i.e. the first disk in the system, when it is not necessarily the case. If your first disk fails, however, your second disk will then be the first disk in the system, and so the MBR will be correct.

The grub.conf does change from the normal install. The difference is in the specified root drive, it is now a RAID drive and no longer a physical drive.For example it would look like:

original: http://www.linuxquestions.org/questions/linux-software-2/installing-rhel-5-w-software-raid-1-a-646939/

 

Installing nagios from source on RHEL.

Requirements:

yum install gcc php httpd zlib gd openssl-devel

Install Server

[root@james nagios]# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz

Configure Server

[root@james nagios-3.2.1]# ./configure –prefix /usr/local/nagios –with-cgiurl=/nagios/cgi-bin –with-nagios-user=nagios \
–with-nagios-group=nagios –with-command-group=nagcmd

[root@james nagios-3.2.1]# make all

[root@james nagios-3.2.1]# make install

[root@james nagios-3.2.1]# make install-init
/usr/bin/install -c -m 755 -d -o root -g root /etc/rc.d/init.d
/usr/bin/install -c -m 755 -o root -g root daemon-init /etc/rc.d/init.d/nagios

*** Init script installed ***

Files with be install in the –prefix path (/usr/loca/nagios)

[root@james nagios]# ls
bin libexec sbin share var

*set cgi.cfg to not use authentication or will not be able to access http files.

[root@james nagios]# grep “use_authentication” etc/cgi.cfg
use_authentication=0

Create sample config files

[root@james nagios-3.2.1]# make install-config
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc/objects
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/cgi.cfg /usr/local/nagios/etc/cgi.cfg
/usr/bin/install -c -b -m 660 -o nagios -g nagios sample-config/resource.cfg /usr/local/nagios/etc/resource.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/templates.cfg /usr/local/nagios/etc/objects/templates.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/commands.cfg /usr/local/nagios/etc/objects/commands.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/contacts.cfg /usr/local/nagios/etc/objects/contacts.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/timeperiods.cfg /usr/local/nagios/etc/objects/timeperiods.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/localhost.cfg /usr/local/nagios/etc/objects/localhost.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/windows.cfg /usr/local/nagios/etc/objects/windows.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/printer.cfg /usr/local/nagios/etc/objects/printer.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/switch.cfg /usr/local/nagios/etc/objects/switch.cfg

*** Config files installed ***

Remember, these are *SAMPLE* config files. You’ll need to read
the documentation for more information on how to actually define
services, hosts, etc. to fit your particular needs.

Create +RW dir

mkdir /usr/local/nagios/var/rw
[root@james var]# chown nagios:nagios rw

Install Nagios (NRPE) Client

Step 1:

requirements:

RHEL:
yum install net-snmp-utils net-snmp-perl net-snmp gcc openssl-devel gcc-c++

*IPtables should be turned off or apply port exception!

*may need to disable exclude=kernel* line in /etc/yum.conf to install kernel-headers for gcc-c++

ubuntu:
apt-get install libssl-dev

client:

[root@james nagios]# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz

Uncompress
tar -xvf nagios-plugins-1.4.15.tar.gz

Build Package
[root@james nagios-plugins-1.4.15]# ./configure –prefix=/usr/local/nrpe –with-openssl=/usr/bin/openssl

*note make sure that output includes ssl support!

–with-apt-get-command:
–with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s
–with-ping-command: /bin/ping -n -U -w %d -c %d %s
–with-ipv6: yes
–with-mysql: no
–with-openssl: yes
–with-gnutls: no
–enable-extra-opts: no
–with-perl: /usr/bin/perl
–enable-perl-modules: no
–with-cgiurl: /nagios/cgi-bin
–with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin
–enable-libtap: no

[root@james nagios-plugins-1.4.15] make

[root@james nagios-plugins-1.4.15]#make install

[root@james nagios-plugins-1.4.15]#make install-root

Verify all plugins are available….

[root@james libexec]# ls /usr/local/nrpe/libexec/
check_apt check_disk check_http check_load check_nt check_ping check_ssh check_wave utils.sh
check_breeze check_disk_smb check_icmp check_log check_ntp check_pop check_swap include
check_by_ssh check_dns check_ide_smart check_mailq check_ntp_peer check_procs check_tcp libexec
check_clamd check_dummy check_ifoperstatus check_mrtg check_ntp_time check_real check_time negate
check_cluster check_file_age check_ifstatus check_mrtgtraf check_nwstat check_rpc check_udp share
check_dhcp check_flexlm check_imap check_nagios check_oracle check_sensors check_ups urlize
check_dig check_ftp check_ircd check_nntp check_overcr check_smtp check_users utils.pm

Step 2:

Build NRPE binary and check_nrpe

download:

# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
# tar -xzf nrpe-2.12.tar.gz
# cd nrpe-2.12
#./configure

*** Configuration summary for nrpe 2.12 03-10-2008 ***:

General Options:
————————-
NRPE port: 5666
NRPE user: nagios
NRPE group: nagios
Nagios user: nagios
Nagios group: nagios

Review the options above for accuracy. If they look okay,
type ‘make all’ to compile the NRPE daemon and client.

[root@magruber]# make
[root@magruber]# make all

Move check_nrpe plugin to plugins dir on nagios master server (not client

[root@magruber]# cp ./src/check_nrpe /usr/local/nrpe/libexec/
[root@magruber]# ls /usr/local/nrpe/libexec | grep check_nrpe
check_nrpe

Copy NRPE dameon

cp ./src/nrpe /usr/local/nrpe/

Nrpe.cfg file

scp monk:/root/scripts/nrpe.cfg /usr/local/nrpe/

Copy CHECK_* custom scripts

[root@shaggy nrpe-2.12]# scp monk:/root/scripts/check_* /usr/local/nrpe/libexec/
root@monk’s password:
check_ipmi 100% 489 0.5KB/s 00:00
check_lab_backups 100% 574 0.6KB/s 00:00
check_mdadm 100% 252 0.3KB/s 00:00
check_omreport 100% 1410 1.4KB/s 00:00
check_oracle 100% 8326 8.1KB/s 00:00
check_uptime 100% 108 0.1KB/s 00:00

*check_memory script won’t run unless /etc/sudoers contains the following line!

nagios ALL=(ALL) NOPASSWD: /usr/local/nrpe/libexec/

Add nrpe to startup

scp stone:/etc/init.d/nrpe /etc/init.d/
[root@shaggy nrpe-2.12]# chkconfig –add nrpe
[root@shaggy nrpe-2.12]# chkconfig –level 345 nrpe on
[root@shaggy nrpe-2.12]# chkconfig –list nrpe
nrpe 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Nrpe Init Script

####

Edit nrpe.cfg

#change from localhost to master nagios server.
allowed_hosts=10.200.50.100

Make sure paths match for plugins. In this example you will need to change /usr/local/nagios/ to /usr/local/nrpe.

Start nrpe and verify is started.

[root@scrappy nrpe]# ./nrpe -d /usr/local/nrpe/nrpe.cfg
[root@scrappy nrpe]# ps -ef | grep nrpe
4294967295 3899 1 0 12:46 ? 00:00:00 ./nrpe -d /usr/local/nrpe/nrpe.cfg
root 3901 3866 0 12:46 pts/2 00:00:00 grep nrpe

Verify can access from nagios server.

[root@james libexec]# /usr/local/nagios/libexec/check_nrpe -H scrappy
NRPE v2.12

define hostgroup{
hostgroup_name ssh-servers ; The name of the hostgroup
alias ssh-servers ; Long name of the group
members magnum,monk,kojak,quincy,stone,baretta,macgruber,marion,donuts,coffee,scrappy ;
}

Restart nagios

root@james objects]# /etc/init.d/nagios restart
Running configuration check…done.
Stopping nagios: .done.
Starting nagios: done.

NRPE Scripts that required SUDO Privileges.

On the remote servers:

1. Move the script to /usr/local/nrpe/libexec/ – the script should have the sudo command before ethtool
2. Vi /usr/local/nrpe/nrpe.cfg and include the line: “command[check_link_speed]=sudo /usr/local/nrpe/libexec/check_link_speed”
3. Visudo and
a. Comment out this line: “Defaults requiretty”
b. Add this line: “nagios ALL=(ALL) NOPASSWD:/usr/local/nrpe/libexec/check_link_speed”
4. Restart nrpe and it should work.

Nagios Dell custom plugin scripts

IPMI Tool

scp stone:/usr/local/nrpe/libexec/check_ipmi /usr/local/nrpe/libexec #requires ipmitools

yum install ipmitool

-add to crontab
[root@quincy ~]# crontab -u root -l
*/10 * * * * /usr/bin/ipmitool sdr > /tmp/ipmi-out.txt

Then run check_ipmi script to check

[root@donuts ~]# /usr/local/nrpe/libexec/check_ipmi -t
Temp -66degreesC ok Temp -69degreesC ok Temp -68degreesC ok Temp -65degreesC ok Temp 40degreesC ok Temp 40degreesC ok Temp 22degreesC ok

[root@donuts ~]# /usr/local/nrpe/libexec/check_ipmi -f
FAN1RPM 2550RPM ok FAN2RPM 2475RPM ok FAN3RPM 2625RPM ok FAN4RPM 2625RPM ok

Open Manage

Note: May need libxslt for omreport to install correctly>>>>

yum install libxslt

scp stone:/usr/local/nrpe/libexec/check_omreport /usr/local/nrpe/libexec #requires dell open manage

scp stone:/usr/local/nrpe/libexec/check_omreport /usr/local/nrpe/libexec #requires dell open manage

[root@donuts ~]# scp quincy:/root/OMI-SrvAdmin-Dell-Web-LX-620-677.rhel5.tar /root
root@quincy’s password:
OMI-SrvAdmin-Dell-Web-LX-620-677.rhel5.tar 64% 79MB 39.5MB/s 00:01 ETA

-uncrompress

[root@kojak linux]# tar -xvf OMI-SrvAdmin-Dell-Web-LX-620-677.rhel5.tar

-install prereqs

[root@donuts ~]# ls ./linux/RPMS/supportRPMS/opensource-components/RHEL5/
libcmpiCppImpl0-2.0.0-1.1.el5.i386.rpm
libcmpiCppImpl0-2.0.0Dell-1.1.el5.i386.rpm
libwsman1-2.1.5Dell-2.1.el5.i386.rpm
openwsman-client-2.1.5Dell-2.1.el5.i386.rpm
openwsman-server-2.1.5Dell-2.1.el5.i386.rpm
sblim-sfcb-1.3.2Dell-9.1.el5.i386.rpm
sblim-sfcc-2.1.0Dell-6.1.el5.i386.rpm

-run installer:
[root@donuts ~]# ./linux/supportscripts/srvadmin-install.sh

Add following to /root/.bashrc. logout, log back in

alias omreport=’/opt/dell/srvadmin/bin/omreport’

# The following examples use hardcoded command arguments…

command[check_users]=/usr/local/nrpe/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nrpe/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nrpe/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nrpe/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nrpe/libexec/check_procs -w 150 -c 200

Copy plugin files from master to client.

[root@monk nrpe]# scp james:/usr/local/nagios/libexec/* libexec/
The authenticity of host ‘james (10.200.50.100)’ can’t be established.
RSA key fingerprint is ce:69:86:a6:1f:f1:4e:52:1f:18:f0:c9:6e:da:ea:8e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘james,10.200.50.100′ (RSA) to the list of known hosts.
check_apt 100% 332KB 332.1KB/s 00:00
check_breeze 100% 2254 2.2KB/s 00:00
check_by_ssh 100% 108KB 108.4KB/s 00:00
check_clamd 100% 93KB 92.9KB/s 00:00
check_cluster 100% 62KB 62.5KB/s 00:00
check_dhcp 100% 99KB 99.3KB/s 00:00
check_dig 100% 101KB 101.0KB/s 00:00
check_disk
…..

Add nagios users and group

[root@monk nrpe]# useradd nagios
[root@monk nrpe]# chown -R nagios:nagios /usr/local/nrpe/

Make sure that Nagios has all privs to scripts dir. Use visudo command.

[root@donuts ~]# grep “nagios” /etc/sudoers
nagios ALL=(ALL) NOPASSWD: /usr/local/nrpe/libexec/

Start Daemon

[root@monk nrpe]# ps -ef | grep nrpe
nagios 18401 1 0 15:13 ? 00:00:00 ./nrpe -d /usr/local/nrpe/nrpe.cfg
root 18403 18110 0 15:14 pts/1 00:00:00 grep nrpe

Verify nrpe on client is running on port 5666.

[root@monk nrpe]# netstat -ntla | grep 5666
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN

Test connection from nagios master

[root@james objects]# /usr/local/nagios/libexec/check_nrpe -H 10.200.1.11 -p5666
NRPE v2.12

*If you get a “Connection refused by host” then the deamon is not propertly running on the client.

Now run nrpe module to test.

[root@james objects]# /usr/local/nagios/libexec/check_nrpe -H 10.200.1.11 -p5666 -c check_disk
DISK OK – free space: / 128225 MB (51% inode=99%);| /=122419MB;211428;237857;0;264286

Note: When you run the test you must specify the name in the command[] brackets per the below!
command[check_disk]=/usr/local/nrpe/libexec/check_disk -w 20% -c 10% -p /

Booya!!

enable cgi downtime scheduling in nagios

1. enable nagios.cmd access.
[root@james conf]# chmod -R 777 /usr/local/nagios/var/rw/[root@james conf]# ls -la /usr/local/nagios/var/rw/total 8drwxrwxrwx 2 nagios nagios 4096 Dec 29 12:51 .drwxrwxr-x 7 nagios nagios 4096 Dec 29 12:54 ..prwxrwxrwx 1 nagios nagios 0 Dec 29 12:54 nagios.cmdprwxrwxrwx 1 nagios nagios 0 Dec 27 16:02 nagios.cmd-old
2. add auth user to access cgi’s in cgi.cfg

use_authenticaiontion=1
add authenticated user (name of user logged in via .htaccess file) or * for all for following.

authorized_for_system_information=*authorized_for_configuration_information=*authorized_for_system_commands=*authorized_for_all_services=*authorized_for_all_hosts=*authorized_for_all_service_commands=*authorized_for_all_host_commands=*

3. nagios.cfg enable check_external_commands=1
4. restart nagios.

Setup htaccess protect.

Modify httpd.conf

[root@james html]# grep “AllowOverride All” -A 5 -B 5 /etc/httpd/conf/httpd.conf
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#

Restart apache

Add .htaccess file to /var/www/html/nagios

[root@james html]# cat > /var/www/html/nagios/.htaccess
AuthName “Nagios”
AuthType Basic
AuthUserFile /var/www/html/nagios/.htpasswd
require valid-user

Create user pass auth file

[root@james html]# htpasswd -c /usr/local/nagios/share/.htpasswd nagios
New password:
Re-type new password:
Adding password for user nagios

uyser/pass: nagios/k@tz31@B

*If have problems authenticating then check /var/log/httpd/error_log

HTTPD config

Add below lines to httpd.conf. Restart apache.

#needed to cgi access

ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin/


Options ExecCGI
AllowOverride AuthConfig
Order allow,deny
Allow from all
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/share/.htpasswd
Require valid-user

Alias /nagios/ /usr/local/nagios/share/

Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all

Modify cgi.cfg

[root@james nagios]# grep “use_authentication” /usr/local/nagios/etc/cgi.cfg
use_authentication=0

Update contact info

[root@james objects]# grep “email” /usr/local/nagios/etc/objects/contacts.cfg
email jjest@u.washington.edu ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******

Create hosts.cfg and hostgroup.cfg files

Add lines to /usr/local/nagios/etc/objects/nagios.cfg

[root@james objects]# grep “cfg_file” -A 1 -B 1 /usr/local/nagios/etc/nagios.cfg
# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg

#added by jj
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg

Disable localhost.cfg file for simplicity.

[root@james objects]# grep “localhost.cfg” -B 2 ../nagios.cfg

# Definitions for monitoring the local (Linux) host
#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

hosts.cfg

[root@james objects]# head /usr/local/nagios/etc/objects/hosts.cfg
define host{
use linux-server
host_name magnum
alias magnum
address 10.200.1.40
}

define host{
use linux-server
host_name monk

hosgroups.cfg

[root@james objects]# head /usr/local/nagios/etc/objects/hostgroups.cfg
define hostgroup{
hostgroup_name ssh-servers ; The name of the hostgroup
alias ssh-servers ; Long name of the group
members magnum,monk,kojak,quincy,scooby,stone,marlowe,rockford ;
}

Run pref light check for errors.

[root@james nagios]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

[root@james objects]# /etc/init.d/nagios restart
Running configuration check…done.
Stopping nagios: done.
Starting nagios: done.

==================================

Troubleshooting

UUID Email Error:

—–Original Message—–
From: 4294967295@lenora.micro.washington.edu [mailto:4294967295@lenora.micro.washington.edu]
Sent: Tuesday, August 23, 2011 10:54 AM
To: root@lenora.micro.washington.edu
Subject: *** SECURITY information for lenora.micro.washington.edu ***

lenora.micro.washington.edu : Aug 23 10:53:56 : 4294967295 : unknown uid: 4294967295 ; TTY=unknown ; PWD=unknown ; COMMAND=/usr/local/nrpe/libexec/check_link_speed

Answer: User and group ‘nagios’ need to be added to system.

If running RHEL 4 u may get this error when trying to start nrpe client

[root@baretta nrpe]# ./nrpe -d /usr/local/nrpe/nrpe.cfg
./nrpe: error while loading shared libraries: requires glibc 2.5 or later dynamic linker

Resolution:

Configuring Plugins

check_snmp: http://wiki.nagios.org/index.php/Howtos:snmp

check_sensors: need to install lmsensors.

===============================================

NRPE Client Install for Windows

-Download appropriate cpu archiecture:

http://sourceforge.net/projects/nscplus/

example setup screen. no other config needed.

-verify service is running.

-modify NSC.ini file on client

C:\Program Files\NSClient++\NSC.ini

[Settings]
allowed_hosts=10.200.50.100,10.200.1.124

[NSCClient]

port=12489

[NRPE]
port=5666

-Check client connection

[root@james libexec]# /usr/local/nagios/libexec/check_nrpe -H green
I (0.3.7.493 2009-10-12) seem to be doing fine…

Sample COmmands:

[root@james libexec]# /usr/local/nagios/libexec/check_nt -H green -v UPTIME -p12489
System Uptime – 25 day(s) 1 hour(s) 10 minute(s)

[root@james libexec]# /usr/local/nagios/libexec/check_nt -H green -p 12489 -v USEDDISKSPACE -l c
c:\ – total: 33.89 Gb – used: 12.31 Gb (36%) – free 21.58 Gb (64%) | ‘c:\ Used Space’=12.31Gb;0.00;0.00;0.00;33.89

[root@james libexec]# /usr/local/nagios/libexec/check_nt -H green -p 12489 -v MEMUSE
Memory usage: total:5731.60 Mb – used: 433.79 Mb (8%) – free: 5297.80 Mb (92%) | ‘Memory usage’=433.79Mb;0.00;0.00;0.00;5731.60

[root@james libexec]# /usr/local/nagios/libexec/check_nt -H green -p 12489 -v CPULOAD -l 60,90,95
CPU Load 0% (60 min average) | ’60 min avg Load’=0%;90;95;0;100

-uncoment following in nagios.cfg on nagios server.

# Definitions for monitoring a Windows machinecfg_file=/usr/local/nagios/etc/objects/windows.cfg

Open Manage install for EQ nagios checks:

 

*RHEL5 does not come w/ xfs. Download and compile from here: http://147.52.159.12/mirrors/ftp.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/

*If you get a ‘device resource busy error’ then try removing ‘dmraid’ with yum and reboot. http://www.righteoushack.net/?p=197

root@drvault:~# mdadm –create –force /dev/md0 –level=raid5 –spare-devices=1 –raid-devices=11 /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk /dev/sdl /dev/sdm
mdadm: /dev/sda appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
mdadm: /dev/sdb appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
mdadm: /dev/sdc appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
mdadm: /dev/sdd appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
mdadm: /dev/sde appears to be part of a raid array:
level=raid5 devices=10 ctime=Fri Dec 10 13:21:26 2010
mdadm: /dev/sdg appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
mdadm: /dev/sdh appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
mdadm: /dev/sdi appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
mdadm: /dev/sdj appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
mdadm: /dev/sdk appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
mdadm: /dev/sdl appears to contain an ext2fs file system
size=-1073741824K mtime=Fri Feb 25 11:01:36 2011
mdadm: /dev/sdl appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
mdadm: /dev/sdm appears to be part of a raid array:
level=raid5 devices=11 ctime=Wed Feb 9 16:26:28 2011
Continue creating array? yes
mdadm: array /dev/md0 started.

#partition device

root@drvault:~# parted /dev/md0
GNU Parted 2.2
Using /dev/md0
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/md0 will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) mkpart primary ext4 0 15TB
(parted) print
Model: Unknown (unknown)
Disk /dev/md0: 20.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 655kB 15.0TB 15.0TB primary

*format w/ xfs. supports 15TB and greater

Xfs Installation…

RHEL:
yum install gcc+ g++ e2fsprogs e2fsprogs-devel

Debian:
apt-get install xfsprogs

root@drvault:~# mkfs.xfs -f /dev/md0
meta-data=/dev/md0 isize=256 agcount=32, agsize=152618320 blks
= sectsz=4096 attr=2
data = bsize=4096 blocks=4883786240, imaxpct=5
= sunit=16 swidth=160 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal log bsize=4096 blocks=521728, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

root@drvault:~# fsck.xfs
If you wish to check the consistency of an XFS filesystem or
repair a damaged filesystem, see xfs_check(8) and xfs_repair(8).
root@drvault:~# xfs_check /dev/md0

#verify mounting

root@drvault:~# mount /dev/md0 /data
root@drvault:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/drvault-root
900G 1.1G 854G 1% /
none 3.0G 308K 3.0G 1% /dev
none 3.0G 0 3.0G 0% /dev/shm
none 3.0G 40K 3.0G 1% /var/run
none 3.0G 0 3.0G 0% /var/lock
none 3.0G 0 3.0G 0% /lib/init/rw
/dev/sdf1 228M 20M 196M 10% /boot
/dev/md0 19T 5.5M 19T 1% /data

#save new raid information in mdadm conf file. this command will assemble the drives on boot.

mdadm –examine –scan > /etc/mdadm/mdadm.conf

#find uuid and add to fstab

root@drvault:~# ls -la /dev/disk/by-uuid/ | grep md0
lrwxrwxrwx 1 root root 9 2011-02-28 16:33 b63dec53-7c22-4bac-ab48-367da1eadeb9 -> ../../md0

#Add to /etc/fstab

UUID=b63dec53-7c22-4bac-ab48-367da1eadeb9 /data xfs defaults 0 0

#setup email alerts

root@biovault:/usr/local/nrpe# mdadm –monitor –scan –daemonise –mail=root@localhost –delay=600 /dev/md0
4709

TROUBLE SHOOTING:

If this disk “mdadm: Cannot open /dev/sd* Device or resource busy” and/or you cannot zero-block the drive out then try the below. Note you will need dmraid installed to perform actions….

1) Try booting w/ nodmraid option and reboot.

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-274.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-274.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet nodmraid
initrd /initrd-2.6.18-274.el5.img

2) if step1 doesn’t work try the below.

[root@nhpvault ~]# mdadm –zero-superblock /dev/sd[i,k]
mdadm: Couldn’t open /dev/sdi for write – not zeroing
mdadm: Couldn’t open /dev/sdk for write – not zeroing

Try this…..

[root@nhpvault ~]# dmraid -R /dev/sd*
ERROR: ddf1: wrong # of devices in RAID set “ddf1_New_VD” [1/2] on /dev/sdi
ERROR: ddf1: wrong # of devices in RAID set “ddf1_New_VD” [1/2] on /dev/sdk
ERROR: only one argument allowed for this option
no raid sets and with names: “/dev/sda1,/dev/sda2,/dev/sdb,/dev/sdc,/dev/sdd,/dev/sde,/dev/sdf,/dev/sdg,/dev/sdh,/dev/sdi,/dev/sdj,/dev/sdk,/dev/sdl”

[root@nhpvault ~]# dmraid -s ddf1_New_VD
*** Group superset .ddf1_disks
–> Active Subset
name : ddf1_New_VD
size : 11720738560
stride : 128
type : stripe
status : ok
subsets: 0
devs : 2
spares : 0
[root@nhpvault ~]# dmraid -x ddf1_New_VD
ERROR: ddf1_New_VD is active and cannot be deleted

[root@nhpvault ~]# dmsetup remove ddf1_New_VD
[root@nhpvault ~]# dmraid -x ddf1_New_VD

About to delete RAID set ddf1_New_VD

WARNING: The metadata stored on the raidset(s) will not be accessible after deletion
Do you want to continue ? [y/n] :y
ERROR: Raid set deletion is not supported in “ddf1″ format

Erase meta data
[root@nhpvault ~]# dmraid -E -r /dev/sdiDo you really want to erase “ddf1″ ondisk metadata on /dev/sdi ? [y/n] :yERROR: ddf1: seeking device “/dev/sdi” to 1536303606530048ERROR: writing metadata to /dev/sdi, offset 3000592981504 sectors, size 0 bytes returned 0ERROR: erasing ondisk metadata on /dev/sdi Zero block all info….

[root@nhpvault ~]# mdadm –zero-superblock /dev/sd[b-l]
mdadm: Unrecognised md component device – /dev/sdb
mdadm: Unrecognised md component device – /dev/sdc
mdadm: Unrecognised md component device – /dev/sdd
mdadm: Unrecognised md component device – /dev/sde
mdadm: Unrecognised md component device – /dev/sdf
mdadm: Unrecognised md component device – /dev/sdg
mdadm: Unrecognised md component device – /dev/sdh
mdadm: Unrecognised md component device – /dev/sdi
mdadm: Unrecognised md component device – /dev/sdj
mdadm: Unrecognised md component device – /dev/sdk
mdadm: Unrecognised md component device – /dev/sdl

**If problem continues after reboot then remove ‘dmraid’

 

*download PythonWin for modules.

//get user name

>>> import win32api

>>> username=win32api.GetUserName()
>>> print(username)

jjest

>>> import win32api

>>> computername=win32api.GetComputerName()

>>> print(computername)

TUBBS-PC

>>> free=win32api.GetDiskFreeSpace()

>>> print(free)

(8, 512, 106922325, 122096127)

/pyhandle object error

>>> print(win32api.PostMessage(‘hi’,1))
Traceback (most recent call last):
File ““, line 1, in
TypeError: The object is not a PyHANDLE object

//get version

>>> version=win32api.GetVersion
>>> print(version)

>>> version=win32api.GetVersion()
>>> print(version)
498073862

//disk space

>>> a=win32api.GetVolumeInformation(“C:\\”)\

>>> print(a)
(”, 1284288434, 255, 65470719, ‘NTFS’)

//get drive labels

>>> drives=win32api.GetLogicalDriveStrings()

>>> print(drives)

C:\

 

Install RRD Tool First!

http://www.cyberciti.biz/faq/howto-install-rrdtool-on-rhel-linux/

yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel

uncompress

[root@james rrdtool-1.3.1]# tar -xzvf rrdtool-1.3.1.tar.gz

configure

[root@james opt]# export PKG_CONFIG_PATH=/usr/lib/pkgconfig/
[root@james opt]# cd rrdtool-1.3.1
[root@james rrdtool-1.3.1]# ./configure

Result…

Config is DONE!

With MMAP IO: yes
Static programs: no
Perl Modules: perl_piped perl_shared
Perl Binary: /usr/bin/perl
Perl Version: 5.8.8
Perl Options: PREFIX=/usr/local/rrdtool-1.3.1 LIB=/usr/local/rrdtool-1.3.1/lib/perl/5.8.8
Ruby Modules:
Ruby Binary: no
Ruby Options: sitedir=$(DESTDIR)NONE/lib/ruby
Build Tcl Bindings: no
Build Python Bindings: no
Build rrdcgi: yes
Build librrd MT: yes
Link with libintl: yes

Libraries: -lxml2 -lcairo -lcairo -lcairo -lm -lcairo -lpng12 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0

Type ‘make’ to compile the software and use ‘make install’ to
install everything to: /usr/local/rrdtool-1.3.1.

… that wishlist is NO JOKE. If you find RRDtool useful
make me happy. Go to http://tobi.oetiker.ch/wish and
place an order.

— Tobi Oetiker

Complete build…

make
make install

Install PNP4Nagios

[root@james pnp4nagios-0.6.6]# ./configure –datarootdir=/usr/local/nagios/share/pnp –with-rrdtool=/opt/rrdtool-1.3.1/src/rrdtool –sysconfdir=/usr/local/nagios/etc/pnp –with-perfdata-dir=/usr/local/nagios/share/perfdata \
–with-perfdata-logfile=/usr/local/nagios/var/perfdata.log –with-perfdata-spool-dir=/usr/local/nagios/var/spool/perfdata

*** Configuration summary for pnp4nagios-0.6.6 08-07-2010 ***

General Options:
————————- ——————-
Nagios user/group: nagios nagios
Install directory: /usr/local/pnp4nagios
HTML Dir: /usr/local/nagios/share/pnp
Config Dir: /usr/local/nagios/etc/pnp
Location of rrdtool binary: /opt/rrdtool-1.3.1/src/rrdtool Version 1.3.1
RRDs Perl Modules: *** NOT FOUND ***
RRD Files stored in: /usr/local/nagios/share/perfdata
process_perfdata.pl Logfile: /usr/local/nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/nagios/var/spool/perfdata

Web Interface Options: ————————- ——————-
HTML URL: http://localhost/pnp4nagios
Apache Config File: /etc/httpd/conf.d/pnp4nagios.conf

Finish compile.

make
make install

*** Main program, Scripts and HTML files installed ***

Please run ‘make install-webconf’ to install the
web configuration file

Please run ‘make install-config’ to install sample
configuration files

Please run ‘make install-init’ if you want to use
BULK Mode with NPCD

Configuration

[root@james conf.d]# htpasswd -c nagiosadmin /usr/local/nagios/etc/htpasswd.users
New password:
Re-type new password:
Adding password for user /usr/local/nagios/etc/htpasswd.users

Review the options above for accuracy. If they look okay,
type ‘make all’ to compile.

WARNING: The RRDs Perl Modules are not found on your system
Using RRDs will speedup things in larger installations.

 

First, find the rpmforge needed for your release.

http://pkgs.repoforge.org/rpmforge-release/

Download and install….

[root@hn ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
–2011-12-14 13:00:37– http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Resolving pkgs.repoforge.org… 78.46.17.228
Connecting to pkgs.repoforge.org|78.46.17.228|:80… connected.
HTTP request sent, awaiting response… 302 Found
Location: http://rpmforge.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm [following]
–2011-12-14 13:00:38– http://rpmforge.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Resolving rpmforge.sw.be… 78.46.17.228
Connecting to rpmforge.sw.be|78.46.17.228|:80… connected.
HTTP request sent, awaiting response… 301 Moved Permanently
Location: http://tree.repoforge.org/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm [following]
–2011-12-14 13:00:39– http://tree.repoforge.org/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Resolving tree.repoforge.org… 78.46.17.228
Connecting to tree.repoforge.org|78.46.17.228|:80… connected.
HTTP request sent, awaiting response… 301 Moved Permanently
Location: http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm [following]
–2011-12-14 13:00:39– http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Resolving apt.sw.be… 193.1.193.67
Connecting to apt.sw.be|193.1.193.67|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 12700 (12K) [application/x-redhat-package-manager]
Saving to: ârpmforge-release-0.5.2-2.el6.rf.x86_64.rpmâ

100%[========================================================================================>] 12,700 30.4K/s in 0.4s

2011-12-14 13:00:40 (30.4 KB/s) – ârpmforge-release-0.5.2-2.el6.rf.x86_64.rpmâ

[root@hn ~]# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
warning: rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Preparing… ########################################### [100%]
1:rpmforge-release ########################################### [100%]
[root@hn ~]# yum install htop
Loaded plugins: refresh-packagekit, rhnplugin, security
rpmforge | 1.1 kB 00:00
rpmforge/primary | 1.4 MB 00:06
rpmforge 4091/4091
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package htop.x86_64 0:0.9-1.el6.rf will be installed
–> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
htop x86_64 0.9-1.el6.rf rpmforge 76 k

Transaction Summary
==================================================================================================================================
Install 1 Package(s)

Total download size: 76 k
Installed size: 188 k
Is this ok [y/N]:

 

Rsync: Daemon Mode on Nonstandard Port

EditNewManageHistoryPrint

Runs rysnc in deamon mode & non standar port

If the file does not exist, create it, with the contents:

service rsync
{
disable = no #change from yes to no.
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = –daemon
log_on_failure += USERID
}

setup share

[root@james ~]# cat > /etc/rsyncd.conf

max connections = 2
log file = /var/log/rsync.log
timeout = 300

[pub]
comment = Random things available for download
path = /pub
read only = yes
list = yes
uid = root #system user for files you want to access.
gid = root
auth users = pub #non system user, located in secrets file.
secrets file = /etc/rsyncd.secrets
hosts allow = 10.200.1.101

Create password file

[root@james ~]# cat > /etc/rsyncd.secrets
pub:pub

[root@james ~]# chmod 700 /etc/rsyncd.secrets

Add to your: “/etc/inetd.conf”:

rsync stream tcp nowait root /usr/bin/rsync rsync –daemon

Modify in /etc/services, or enter nonstantard port. For external mapping of service by client.

rsync 3900/tcp
rsync 3900/udp

Restart xinit.d

[root@james ~]# /etc/init.d/xinetd restart

Start rsync daemon (have to specify port)

[root@james ~]# rsync –daemon –port=3900

Verify listening

[root@james ~]# netstat -ntla | grep 3900
tcp 0 0 0.0.0.0:3900 0.0.0.0:* LISTEN
tcp 0 0 10.200.50.100:3900 10.200.1.101:33125 TIME_WAIT
tcp 0 0 :::3900 :::* LISTEN

From client, test connection

root@firefly:~# rsync -avn –port=3900 pub@james::pub /
Password:
receiving file list … done
./

sent 104 bytes received 123 bytes 90.80 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)

Troubleshooting:

tail rsync.log on server.

[root@james ~]# tail -f /var/log/rsync.log

ref:

http://transamrit.net/docs/rsync/

http://www.linuxjournal.com/article/6508?page=0,0

 

[root@jackson cron.d]# list[0]=jkl
[root@jackson cron.d]# list[1]=jkl
[root@jackson cron.d]# echo ${list[@]}
jkl jkl jkl

[root@jackson libexec]# name=”jeremiah”
[root@jackson libexec]# name=”$name jester”
[root@jackson libexec]# echo $name
jeremiah jester

 

If you mount a Windows 7 share using Samba/CIFS you may run into “mount error(12): Cannot allocate memory” if you are using very large files on the Windows machine. Looks like in certain situations Windows needs to be told to run as a file server and to expect large files. You can read more details at Large Files are locking up Windows 7 32 bit and 64 bit, but the solution is to make two registry edits and then restart a service:

Set “HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache” to “1″.
Set “HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size” to “3″.
Restart the “server” service.
Once you have done that you should be able to mount the share using a command like “sudo mount -a” or just reboot the Linux machine.

ref: http://jlcoady.net/windows/how-to-resolve-mount-error12-cannot-allocate-memory-windows-share

 

Many times when i setup multiple nic’s on the same machine using LAN (eth0) and WAN (eth1) ip’s. The reason is likely due to a Gateway not being setup correctly in your nic settings. In this case my WAN nic is bound to eth0 and would not ping.

[root@cn2 ~]# ping nike.com
PING nike.com (66.54.56.30) 56(84) bytes of data.
From cn2 (192.168.1.2) icmp_seq=2 Destination Host Unreachable
From cn2 (192.168.1.2) icmp_seq=3 Destination Host Unreachable
From cn2 (192.168.1.2) icmp_seq=4 Destination Host Unreachable
From cn2 (192.168.1.2) icmp_seq=5 Destination Host Unreachable

See current routes…

[root@cn2 ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
link-local * 255.255.0.0 U 1003 0 0 eth1
10.200.0.0 * 255.255.0.0 U 0 0 0 eth1
default 10.200.1.2 0.0.0.0 UG 0 0 0 eth0

Add new route on correct device.

[root@cn2 ~]# route add default gw 10.200.1.2 netmask 0.0.0.0 dev eth1
[root@cn2 ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
link-local * 255.255.0.0 U 1003 0 0 eth1
10.200.0.0 * 255.255.0.0 U 0 0 0 eth1
default 10.200.1.2 0.0.0.0 UG 0 0 0 eth1
default 10.200.1.2 0.0.0.0 UG 0 0 0 eth0

Delete old route.

[root@cn2 ~]# route del default dev eth0
[root@cn2 ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
link-local * 255.255.0.0 U 1003 0 0 eth1
10.200.0.0 * 255.255.0.0 U 0 0 0 eth1
default 10.200.1.2 0.0.0.0 UG 0 0 0 eth1

Done!

 

1. enable nagios.cmd access.

[root@james conf]# chmod -R 777 /usr/local/nagios/var/rw/
[root@james conf]# ls -la /usr/local/nagios/var/rw/
total 8
drwxrwxrwx 2 nagios nagios 4096 Dec 29 12:51 .
drwxrwxr-x 7 nagios nagios 4096 Dec 29 12:54 ..
prwxrwxrwx 1 nagios nagios 0 Dec 29 12:54 nagios.cmd
prwxrwxrwx 1 nagios nagios 0 Dec 27 16:02 nagios.cmd-old

2. add auth user to access cgi’s in cgi.cfg

use_authenticaiontion=1

add authenticated user (name of user logged in via .htaccess file) or * for all for following.

authorized_for_system_information=*
authorized_for_configuration_information=*
authorized_for_system_commands=*
authorized_for_all_services=*
authorized_for_all_hosts=*
authorized_for_all_service_commands=*
authorized_for_all_host_commands=*

3. nagios.cfg enable check_external_commands=1

4. restart nagios.

 

INSTALL on RHEL6

1.Archive to use for RHEL6.

OMSA 6.5 – wget http://ftp.us.dell.com/sysman/OM-SrvAdmin-Dell-Web-LX-6.5.0-2247.RHEL5.x86_64_A01.4.tar.gz

2.Required libraries are in yum repo.

yum install sblim-sfcb yum install sblim-sfcc yum install opensman-server yum install opensman-client

3.Run ./srvadmin-install.sh –express

INSTALL on RHEL 5

[root@lange ~]# wget -q -O – http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
Downloading GPG key: http://linux.dell.com/repo/hardware/latest/RPM-GPG-KEY-dell
Importing key into RPM.
Downloading GPG key: http://linux.dell.com/repo/hardware/latest/RPM-GPG-KEY-libs mbios
Importing key into RPM.
Write repository configuration
Downloading repository RPM
Installing repository rpm: http://linux.dell.com/repo/hardware/latest/platform_i ndependent/rh50_64/prereq/dell-omsa-repository-2-5.noarch.rpm
Installing yum plugins for system id
Loaded plugins: rhnplugin, security
dell-omsa-indep | 1.9 kB 00:00
dell-omsa-indep/primary | 97 kB 00:00
dell-omsa-indep 723/723
dell-omsa-specific | 1.9 kB 00:00
dell-omsa-specific/primary | 97 kB 00:00
dell-omsa-specific 723/723
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package yum-dellsysid.x86_64 0:2.2.26-6.2.el5 set to be updated
–> Processing Dependency: smbios-utils-python >= 2.2.0 for package: yum-dellsysid
–> Running transaction check
—> Package smbios-utils-python.x86_64 0:2.2.26-6.2.el5 set to be updated
–> Processing Dependency: python-smbios = 2.2.26-6.2.el5 for package: smbios-utils-python
–> Running transaction check
—> Package python-smbios.x86_64 0:2.2.26-6.2.el5 set to be updated
–> Processing Dependency: libsmbios = 2.2.26-6.2.el5 for package: python-smbios
–> Processing Dependency: python-ctypes for package: python-smbios
–> Running transaction check
—> Package libsmbios.x86_64 0:2.2.26-6.2.el5 set to be updated
—> Package python-ctypes.x86_64 0:1.0.2-1.1.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================
Installing:
yum-dellsysid x86_64 2.2.26-6.2.el5 dell-omsa-indep 16 k
Installing for dependencies:
python-ctypes x86_64 1.0.2-1.1.el5 dell-omsa-specific 215 k
python-smbios x86_64 2.2.26-6.2.el5 dell-omsa-specific 71 k
smbios-utils-python x86_64 2.2.26-6.2.el5 dell-omsa-specific 63 k
Updating for dependencies:
libsmbios x86_64 2.2.26-6.2.el5 dell-omsa-indep 1.5 M

Transaction Summary
=================================================================================================================================================================================
Install 4 Package(s)
Upgrade 1 Package(s)

Total download size: 1.9 M
Downloading Packages:
(1/5): yum-dellsysid-2.2.26-6.2.el5.x86_64.rpm | 16 kB 00:00
(2/5): smbios-utils-python-2.2.26-6.2.el5.x86_64.rpm | 63 kB 00:00
(3/5): python-smbios-2.2.26-6.2.el5.x86_64.rpm | 71 kB 00:00
(4/5): python-ctypes-1.0.2-1.1.el5.x86_64.rpm | 215 kB 00:00
(5/5): libsmbios-2.2.26-6.2.el5.x86_64.rpm | 1.5 MB 00:01
———————————————————————————————————————————————————————————
Total 657 kB/s | 1.9 MB 00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : libsmbios 1/6
Installing : python-ctypes 2/6
Installing : python-smbios 3/6
Installing : smbios-utils-python 4/6
Installing : yum-dellsysid 5/6
Cleanup : libsmbios 6/6

Installed:
yum-dellsysid.x86_64 0:2.2.26-6.2.el5

Dependency Installed:
python-ctypes.x86_64 0:1.0.2-1.1.el5 python-smbios.x86_64 0:2.2.26-6.2.el5 smbios-utils-python.x86_64 0:2.2.26-6.2.el5

Dependency Updated:
libsmbios.x86_64 0:2.2.26-6.2.el5

Complete!
Loaded plugins: dellsysid, security
Cleaning up Everything
Done!

[root@lange ~]# yum install srvadmin-all
Loaded plugins: dellsysid, rhnplugin, security
dell-omsa-indep | 1.9 kB 00:00
dell-omsa-indep/primary | 97 kB 00:00
dell-omsa-indep 723/723
dell-omsa-specific | 1.9 kB 00:00
dell-omsa-specific/primary | 2.8 kB 00:00
dell-omsa-specific 7/7
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package srvadmin-all.x86_64 0:6.5.0-1.1.1.el5 set to be updated
–> Processing Dependency: srvadmin-base = 6.5.0 for package: srvadmin-all
–> Processing Dependency: srvadmin-webserver = 6.5.0 for package: srvadmin-all
–> Processing Dependency: srvadmin-rac4 = 6.5.0 for package: srvadmin-all
–> Processing Dependency: srvadmin-rac5 = 6.5.0 for package: srvadmin-all
–> Processing Dependency: srvadmin-storageservices = 6.5.0 for package: srvadmin-all
–> Processing Dependency: srvadmin-standardAgent = 6.5.0 for package: srvadmin-all
–> Processing Dependency: srvadmin-idrac = 6.5.0 for package: srvadmin-all
–> Running transaction check
—> Package srvadmin-base.x86_64 0:6.5.0-1.1.1.el5 set to be updated
–> Processing Dependency: srvadmin-omacore = 6.5.0 for package: srvadmin-base
–> Processing Dependency: srvadmin-smcommon = 6.5.0 for package: srvadmin-base
—> Package srvadmin-idrac.x86_64 0:6.5.0-1.228.2.el5 set to be updated
–> Processing Dependency: srvadmin-racadm4 = 6.5.0 for package: srvadmin-idrac
–> Processing Dependency: srvadmin-deng for package: srvadmin-idrac
–> Processing Dependency: srvadmin-rac-components for package: srvadmin-idrac
–> Processing Dependency: srvadmin-idrac-vmcli for package: srvadmin-idrac
–> Processing Dependency: srvadmin-idracadm for package: srvadmin-idrac
–> Processing Dependency: srvadmin-omilcore for package: srvadmin-idrac
–> Processing Dependency: srvadmin-racdrsc for package: srvadmin-idrac
–> Processing Dependency: srvadmin-omilcore for package: srvadmin-idrac
–> Processing Dependency: srvadmin-idrac-ivmcli for package: srvadmin-idrac
–> Processing Dependency: srvadmin-isvc for package: srvadmin-idrac
–> Processing Dependency: srvadmin-omcommon for package: srvadmin-idrac
–> Processing Dependency: srvadmin-argtable2 for package: srvadmin-idrac
—> Package srvadmin-rac4.x86_64 0:6.5.0-1.154.2.el5 set to be updated
–> Processing Dependency: srvadmin-racsvc = 6.5.0 for package: srvadmin-rac4
–> Processing Dependency: srvadmin-rac4-populator for package: srvadmin-rac4
—> Package srvadmin-rac5.x86_64 0:6.5.0-1.149.1.el5 set to be updated
–> Processing Dependency: srvadmin-racadm5 = 6.5.0 for package: srvadmin-rac5
—> Package srvadmin-standardAgent.x86_64 0:6.5.0-1.1.1.el5 set to be updated
–> Processing Dependency: srvadmin-itunnelprovider = 6.5.0 for package: srvadmin-standardAgent
—> Package srvadmin-storageservices.x86_64 0:6.5.0-1.1.1.el5 set to be updated
–> Processing Dependency: srvadmin-storage = 6.5.0 for package: srvadmin-storageservices
–> Processing Dependency: srvadmin-sysfsutils = 6.5.0 for package: srvadmin-storageservices
–> Processing Dependency: srvadmin-storelib = 6.5.0 for package: srvadmin-storageservices
—> Package srvadmin-webserver.x86_64 0:6.5.0-1.1.1.el5 set to be updated
–> Processing Dependency: srvadmin-iws = 6.5.0 for package: srvadmin-webserver
–> Processing Dependency: srvadmin-smweb = 6.5.0 for package: srvadmin-webserver
–> Running transaction check
—> Package srvadmin-argtable2.x86_64 0:6.5.0-3.1.el5 set to be updated
—> Package srvadmin-deng.x86_64 0:6.5.0-1.31.1.el5 set to be updated
—> Package srvadmin-idrac-ivmcli.x86_64 0:6.5.0-1.239.1.el5 set to be updated
–> Processing Dependency: libdchipm.so.5()(64bit) for package: srvadmin-idrac-ivmcli
—> Package srvadmin-idrac-vmcli.x86_64 0:6.5.0-1.254.1.el5 set to be updated
—> Package srvadmin-idracadm.x86_64 0:6.5.0-1.228.2.el5 set to be updated
—> Package srvadmin-isvc.x86_64 0:6.5.0-1.52.2.el5 set to be updated
—> Package srvadmin-itunnelprovider.x86_64 0:6.5.0-1.151.1.el5 set to be updated
–> Processing Dependency: openwsman-server >= 2.2.3 for package: srvadmin-itunnelprovider
–> Processing Dependency: sblim-sfcb >= 1.3.7 for package: srvadmin-itunnelprovider
–> Processing Dependency: libcmpiCppImpl.so.0()(64bit) for package: srvadmin-itunnelprovider
—> Package srvadmin-iws.x86_64 0:6.5.0-1.143.3.el5 set to be updated
–> Processing Dependency: srvadmin-jre for package: srvadmin-iws
–> Processing Dependency: libwsman_curl_client_transport.so.1()(64bit) for package: srvadmin-iws
–> Processing Dependency: libwsman.so.1()(64bit) for package: srvadmin-iws
–> Processing Dependency: libwsman_client.so.1()(64bit) for package: srvadmin-iws
—> Package srvadmin-omacore.x86_64 0:6.5.0-1.143.3.el5 set to be updated
–> Processing Dependency: libxmlsup.so.2()(64bit) for package: srvadmin-omacore
—> Package srvadmin-omcommon.x86_64 0:6.5.0-1.142.2.el5 set to be updated
—> Package srvadmin-omilcore.x86_64 0:6.5.0-1.452.1.el5 set to be updated
—> Package srvadmin-rac-components.x86_64 0:6.5.0-1.228.2.el5 set to be updated
—> Package srvadmin-rac4-populator.x86_64 0:6.5.0-1.154.2.el5 set to be updated
—> Package srvadmin-racadm4.x86_64 0:6.5.0-1.154.2.el5 set to be updated
—> Package srvadmin-racadm5.x86_64 0:6.5.0-1.149.1.el5 set to be updated
—> Package srvadmin-racdrsc.x86_64 0:6.5.0-1.228.2.el5 set to be updated
—> Package srvadmin-racsvc.x86_64 0:6.5.0-1.154.2.el5 set to be updated
—> Package srvadmin-smcommon.x86_64 0:6.5.0-1.201.2.el5 set to be updated
—> Package srvadmin-smweb.x86_64 0:6.5.0-1.201.2.el5 set to be updated
—> Package srvadmin-storage.x86_64 0:6.5.0-1.201.2.el5 set to be updated
—> Package srvadmin-storelib.x86_64 0:6.5.0-1.326.1.el5 set to be updated
–> Processing Dependency: srvadmin-storelib-sysfs-x86_64 for package: srvadmin-storelib
–> Processing Dependency: srvadmin-storelib-sysfs for package: srvadmin-storelib
—> Package srvadmin-sysfsutils.x86_64 0:6.5.0-1.1.el5 set to be updated
–> Running transaction check
—> Package libcmpiCppImpl0.x86_64 0:2.0.0Dell-3.1.el5 set to be updated
–> Processing Dependency: libwsman.so.1 for package: openwsman-client
—> Package libwsman1.x86_64 0:2.2.3.9-1.7.2.el5 set to be updated
—> Package openwsman-server.x86_64 0:2.2.3.9-1.7.2.el5 set to be updated
—> Package sblim-sfcb.x86_64 0:1.3.7-1.6.4.el5 set to be updated
—> Package srvadmin-hapi.x86_64 0:6.5.0-1.33.2.el5 set to be updated
—> Package srvadmin-jre.x86_64 0:6.5.0-1.145.1.el5 set to be updated
—> Package srvadmin-storelib-sysfs.x86_64 0:6.5.0-1.1.1.el5 set to be updated
—> Package srvadmin-xmlsup.x86_64 0:6.5.0-1.141.2.el5 set to be updated
–> Running transaction check
—> Package openwsman-client.x86_64 0:2.2.3.9-1.7.2.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================
Installing:
srvadmin-all x86_64 6.5.0-1.1.1.el5 dell-omsa-indep 2.5 k
Installing for dependencies:
srvadmin-argtable2 x86_64 6.5.0-3.1.el5 dell-omsa-indep 58 k
srvadmin-base x86_64 6.5.0-1.1.1.el5 dell-omsa-indep 2.4 k
srvadmin-deng x86_64 6.5.0-1.31.1.el5 dell-omsa-indep 695 k
srvadmin-hapi x86_64 6.5.0-1.33.2.el5 dell-omsa-indep 887 k
srvadmin-idrac x86_64 6.5.0-1.228.2.el5 dell-omsa-indep 2.8 k
srvadmin-idrac-ivmcli x86_64 6.5.0-1.239.1.el5 dell-omsa-indep 202 k
srvadmin-idrac-vmcli x86_64 6.5.0-1.254.1.el5 dell-omsa-indep 106 k
srvadmin-idracadm x86_64 6.5.0-1.228.2.el5 dell-omsa-indep 1.0 M
srvadmin-isvc x86_64 6.5.0-1.52.2.el5 dell-omsa-indep 7.0 M
srvadmin-itunnelprovider x86_64 6.5.0-1.151.1.el5 dell-omsa-indep 2.0 M
srvadmin-iws x86_64 6.5.0-1.143.3.el5 dell-omsa-indep 13 M
srvadmin-jre x86_64 6.5.0-1.145.1.el5 dell-omsa-indep 35 M
srvadmin-omacore x86_64 6.5.0-1.143.3.el5 dell-omsa-indep 1.9 M
srvadmin-omcommon x86_64 6.5.0-1.142.2.el5 dell-omsa-indep 4.2 M
srvadmin-omilcore x86_64 6.5.0-1.452.1.el5 dell-omsa-indep 30 k
srvadmin-rac-components x86_64 6.5.0-1.228.2.el5 dell-omsa-indep 99 k
srvadmin-rac4 x86_64 6.5.0-1.154.2.el5 dell-omsa-indep 2.7 k
srvadmin-rac4-populator x86_64 6.5.0-1.154.2.el5 dell-omsa-indep 32 k
srvadmin-rac5 x86_64 6.5.0-1.149.1.el5 dell-omsa-indep 2.8 k
srvadmin-racadm4 x86_64 6.5.0-1.154.2.el5 dell-omsa-indep 314 k
srvadmin-racadm5 x86_64 6.5.0-1.149.1.el5 dell-omsa-indep 971 k
srvadmin-racdrsc x86_64 6.5.0-1.228.2.el5 dell-omsa-indep 34 k
srvadmin-racsvc x86_64 6.5.0-1.154.2.el5 dell-omsa-indep 39 k
srvadmin-smcommon x86_64 6.5.0-1.201.2.el5 dell-omsa-indep 726 k
srvadmin-smweb x86_64 6.5.0-1.201.2.el5 dell-omsa-indep 18 M
srvadmin-standardAgent x86_64 6.5.0-1.1.1.el5 dell-omsa-indep 2.4 k
srvadmin-storage x86_64 6.5.0-1.201.2.el5 dell-omsa-indep 2.8 M
srvadmin-storageservices x86_64 6.5.0-1.1.1.el5 dell-omsa-indep 2.5 k
srvadmin-storelib x86_64 6.5.0-1.326.1.el5 dell-omsa-indep 303 k
srvadmin-storelib-sysfs x86_64 6.5.0-1.1.1.el5 dell-omsa-indep 44 k
srvadmin-sysfsutils x86_64 6.5.0-1.1.el5 dell-omsa-indep 51 k
srvadmin-webserver x86_64 6.5.0-1.1.1.el5 dell-omsa-indep 2.4 k
srvadmin-xmlsup x86_64 6.5.0-1.141.2.el5 dell-omsa-indep 52 k
Updating for dependencies:
libcmpiCppImpl0 x86_64 2.0.0Dell-3.1.el5 dell-omsa-indep 95 k
libwsman1 x86_64 2.2.3.9-1.7.2.el5 dell-omsa-indep 324 k
openwsman-client x86_64 2.2.3.9-1.7.2.el5 dell-omsa-indep 61 k
openwsman-server x86_64 2.2.3.9-1.7.2.el5 dell-omsa-indep 174 k
sblim-sfcb x86_64 1.3.7-1.6.4.el5 dell-omsa-indep 1.4 M

Transaction Summary
=================================================================================================================================================================================
Install 34 Package(s)
Upgrade 5 Package(s)

Total download size: 91 M
Is this ok [y/N]:

[root@lange srvadmin]# bash /opt/dell/srvadmin/sbin/srvadmin-services.sh start
Starting Systems Management Device Drivers:
Starting dell_rbu: [ OK ]
Starting ipmi driver: Already started [ OK ]
Starting Systems Management Data Engine:
Starting dsm_sa_datamgrd: [ OK ]
Starting dsm_sa_eventmgrd: [ OK ]
Starting dsm_sa_snmpd: [ OK ]
Starting DSM SA Shared Services: [ OK ]

Starting DSM SA Connection Service: [ OK ]

 

root@donkey:~# grep -ir “smtp.comcast.net” /etc/
Binary file /etc/postfix/sasl_passwd.db matches
/etc/postfix/main.cf:relayhost = [smtp.comcast.net]:587
/etc/postfix/sasl_passwd:smtp.comcast.net < username >:< password >

Restart postfix.

Sent mail…

 

I have a bash script where i need to determine if the system is Dell or Non-Dell for add-on software. I looked around on ‘the google’ and found that you can determine the system manufacturer by running the below command.

[root@stone ~]# dmidecode | grep Dell
Vendor: Dell Inc.
Manufacturer: Dell Inc.
Manufacturer: Dell Inc.
Manufacturer: Dell Inc.
String 1: Dell System

[root@stone ~]# dmidecode -s system-product-name
PowerEdge 2950

[root@stone ~]# dmidecode -s bios-version
2.7.0

[root@stone ~]# dmidecode -s system-serial-number
6GV2KH1

Here are all the available options…

[root@stone ~]# dmidecode -s
dmidecode: option requires an argument — s
String keyword expected
Valid string keywords are:
bios-vendor
bios-version
bios-release-date
system-manufacturer
system-product-name
system-version
system-serial-number
system-uuid
baseboard-manufacturer
baseboard-product-name
baseboard-version
baseboard-serial-number
baseboard-asset-tag
chassis-manufacturer
chassis-type
chassis-version
chassis-serial-number
chassis-asset-tag
processor-family
processor-manufacturer
processor-version
processor-frequency

 

GROUP BY DATE

mysql> SELECT host, SUM(tx_diff) as tx_diff, adapter, ip, SUM(rx_diff) as rx_diff, date_format(date,’%b %D’) as dow FROM log where ip=’10.200.1.11′ group by date(date) order by date desc limit 10;
+—————————+————–+———+————-+————–+———-+
| host | tx_diff | adapter | ip | rx_diff | dow |
+—————————+————–+———+————-+————–+———-+
| monk.micro.washington.edu | 565109044386 | eth1 | 10.200.1.11 | 616332195564 | Sep 22nd |
| monk.micro.washington.edu | 215287966 | eth1 | 10.200.1.11 | 27642389383 | Sep 21st |
| monk.micro.washington.edu | 210201744 | eth1 | 10.200.1.11 | 303483939 | Sep 20th |
| monk.micro.washington.edu | 168338833 | eth1 | 10.200.1.11 | 239533210 | Sep 19th |
| monk.micro.washington.edu | 283795426 | eth1 | 10.200.1.11 | 226393293 | Sep 18th |
| monk.micro.washington.edu | 167879344 | eth1 | 10.200.1.11 | 221869928 | Sep 17th |
| monk.micro.washington.edu | 343850040 | eth1 | 10.200.1.11 | 276676860 | Sep 16th |
| monk.micro.washington.edu | 208617927 | eth1 | 10.200.1.11 | 173938951 | Sep 15th |
| monk.micro.washington.edu | 317222382 | eth1 | 10.200.1.11 | 162031338 | Sep 14th |
| monk.micro.washington.edu | 209365672 | eth1 | 10.200.1.11 | 228773179 | Sep 13th |
+—————————+————–+———+————-+————–+———-+
10 rows in set (1.12 sec)

GROUP BY MONTH

mysql> SELECT host, SUM(tx_diff) as tx_diff, adapter, ip, SUM(rx_diff) as rx_diff, date_format(date,’%M’) as month_year, date(date) as date FROM log where ip=’10.200.1.11′ group by date_format(date,’%Y-%c’) order by date desc limit 10;
+—————————+————–+———+————-+————–+————+————+
| host | tx_diff | adapter | ip | rx_diff | month_year | date |
+—————————+————–+———+————-+————–+————+————+
| monk.micro.washington.edu | 565582903163 | eth1 | 10.200.1.11 | 644158532495 | September | 2011-09-01 |
+—————————+————–+———+————-+————–+————+————+
1 row in set (1.15 sec)

GROUP BY WEEK

mysql> SELECT host, SUM(tx_diff) as tx_diff, adapter, ip, SUM(rx_diff) as rx_diff, date_format(date,’%W’) as dow FROM log where ip=’10.200.1.11′ group by date_format(date,’%W’) order by date desc limit 10;
+—————————+————–+———+————-+————–+———–+
| host | tx_diff | adapter | ip | rx_diff | dow |
+—————————+————–+———+————-+————–+———–+
| monk.micro.washington.edu | 1001045977 | eth1 | 10.200.1.11 | 28207975939 | Wednesday |
| monk.micro.washington.edu | 692902253 | eth1 | 10.200.1.11 | 707541136 | Tuesday |
| monk.micro.washington.edu | 521261648 | eth1 | 10.200.1.11 | 708563349 | Monday |
| monk.micro.washington.edu | 926105476 | eth1 | 10.200.1.11 | 700926063 | Sunday |
| monk.micro.washington.edu | 537660737 | eth1 | 10.200.1.11 | 677285321 | Saturday |
| monk.micro.washington.edu | 655542750 | eth1 | 10.200.1.11 | 705438965 | Friday |
| monk.micro.washington.edu | 572138807078 | eth1 | 10.200.1.11 | 623308403828 | Thursday |
+—————————+————–+———+————-+————–+———–+
7 rows in set (1.38 sec)

RECORDS FOR PAST 24 HOURS

mysql> SELECT host, SUM(tx_diff) as tx_diff, adapter, SUM(rx_diff) as rx_diff, date_format(date,’%b %D %h %p’) as dow FROM log where ip=’10.200.1.11′ and date between date_sub(now(),interval 24 hour) and now() group by date_format(date,’%H’) order by date desc; +—————————+————–+———+————–+—————-+
| host | tx_diff | adapter | rx_diff | dow |
+—————————+————–+———+————–+—————-+
| monk.micro.washington.edu | 130414938191 | eth1 | 129831708238 | Sep 22nd 03 PM |
| monk.micro.washington.edu | 130057896533 | eth1 | 129215613916 | Sep 22nd 02 PM |
| monk.micro.washington.edu | 129629346428 | eth1 | 128502661829 | Sep 22nd 01 PM |
| monk.micro.washington.edu | 129221533429 | eth1 | 127824340545 | Sep 22nd 12 PM |
| monk.micro.washington.edu | 10885315048 | eth1 | 16021185857 | Sep 22nd 11 AM |
| monk.micro.washington.edu | 7358250 | eth1 | 5630652540 | Sep 22nd 10 AM |
| monk.micro.washington.edu | 7218214 | eth1 | 5387548561 | Sep 22nd 09 AM |
| monk.micro.washington.edu | 5275165 | eth1 | 5158565423 | Sep 22nd 08 AM |
| monk.micro.washington.edu | 5325261 | eth1 | 4938127636 | Sep 22nd 07 AM |
| monk.micro.washington.edu | 5290874 | eth1 | 4730943343 | Sep 22nd 06 AM |
| monk.micro.washington.edu | 5285302 | eth1 | 4527051636 | Sep 22nd 05 AM |
| monk.micro.washington.edu | 6807211 | eth1 | 4326804360 | Sep 22nd 04 AM |
| monk.micro.washington.edu | 5281350 | eth1 | 4197910141 | Sep 22nd 03 AM |
| monk.micro.washington.edu | 5290722 | eth1 | 3983501232 | Sep 22nd 02 AM |
| monk.micro.washington.edu | 5285438 | eth1 | 3771119213 | Sep 22nd 01 AM |
| monk.micro.washington.edu | 5284276 | eth1 | 3562302274 | Sep 22nd 12 AM |
| monk.micro.washington.edu | 11227607 | eth1 | 3392253923 | Sep 21st 11 PM |
| monk.micro.washington.edu | 2600173 | eth1 | 3429676699 | Sep 21st 10 PM |
| monk.micro.washington.edu | 2556612 | eth1 | 3196016672 | Sep 21st 09 PM |
| monk.micro.washington.edu | 2559485 | eth1 | 2967940563 | Sep 21st 08 PM |
| monk.micro.washington.edu | 2674418 | eth1 | 2630574039 | Sep 21st 07 PM |
| monk.micro.washington.edu | 2556207 | eth1 | 2238077434 | Sep 21st 06 PM |
| monk.micro.washington.edu | 2552245 | eth1 | 2002786733 | Sep 21st 05 PM |
| monk.micro.washington.edu | 45729464710 | eth1 | 46747892032 | Sep 21st 04 PM |
+—————————+————–+———+————–+—————-+
24 rows in set (0.02 sec)

 

root@donkey:~# apt-get install cpufrequtils

root@donkey:~# cpufreq-info
cpufrequtils 006: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: powernow-k8
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 8.0 us.
hardware limits: 800 MHz – 2.70 GHz
available frequency steps: 2.70 GHz, 1.90 GHz, 1.50 GHz, 800 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 800 MHz and 2.70 GHz.
The governor “ondemand” may decide which speed to use
within this range.
current CPU frequency is 800 MHz (asserted by call to hardware).
cpufreq stats: 2.70 GHz:0.09%, 1.90 GHz:0.00%, 1.50 GHz:0.00%, 800 MHz:99.91% (19590)

root@donkey:~# cpufreq-set -g powersave
root@donkey:~# cpufreq-info
cpufrequtils 006: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: powernow-k8
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 8.0 us.
hardware limits: 800 MHz – 2.70 GHz
available frequency steps: 2.70 GHz, 1.90 GHz, 1.50 GHz, 800 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 800 MHz and 2.70 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 800 MHz (asserted by call to hardware).
cpufreq stats: 2.70 GHz:0.09%, 1.90 GHz:0.00%, 1.50 GHz:0.00%, 800 MHz:99.91% (19592)

for dual cpu, set per processor.

root@backupsrv:~# cpufreq-set -g powersave -c 0
root@backupsrv:~# cpufreq-set -g powersave -c 1

cpufrequtils 006: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: powernow-k8
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 8.0 us.
hardware limits: 800 MHz – 2.90 GHz
available frequency steps: 2.90 GHz, 2.20 GHz, 1.70 GHz, 800 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 800 MHz and 2.90 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 800 MHz (asserted by call to hardware).
cpufreq stats: 2.90 GHz:0.10%, 2.20 GHz:0.00%, 1.70 GHz:0.11%, 800 MHz:99.78% (110341)
analyzing CPU 1:
driver: powernow-k8
CPUs which run at the same hardware frequency: 1
CPUs which need to have their frequency coordinated by software: 1
maximum transition latency: 8.0 us.
hardware limits: 800 MHz – 2.90 GHz
available frequency steps: 2.90 GHz, 2.20 GHz, 1.70 GHz, 800 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 800 MHz and 2.90 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 800 MHz (asserted by call to hardware).
cpufreq stats: 2.90 GHz:0.01%, 2.20 GHz:0.00%, 1.70 GHz:0.00%, 800 MHz:99.98% (6750)

root@backupsrv:~# apt-get install powertop

Disable Windows Manager

apt-get install rcconf
-disable unneeded services

*disabling x11 saves me 100 watts!

 

REDIRECT STDOUT TO NEW FILE

python /etc/cron.d/check_perms.py 1> logfile #create new file or overwrite existing
python /etc/cron.d/check_perms.py 1>> logfile #append to existing

REDIRECT STDOUT TO NEW FILE

python /etc/cron.d/check_perms.py 2> logfile #create new file or overwrite existing
python /etc/cron.d/check_perms.py 2>> logfile #append to existing

CRONTAB REDIRECTION

* * * * * root python somefile.py 1> /dev/null, discards stdout, email stderr if set.
* * * * * root python somefile.py 2> /dev/null, discards stderr, email stdout if set.
* * * * * root python somefile.py 2>&1 , emails both stderr and stdout and combines into one stream.
* * * * * root python somefile.py > /dev/null #sends all output to trash

EMAIL SCRIPT OUPUT FROM CMD LINE

All output…

python ./check_perms.py 2>&1 | mail -s ‘files perms’ jjest@uw.edu

To get output from stderr or stdout you must redirect to file first then to mail address…
*This is the onloy way i can get thish to work!!!

SENDS STDOUT TO EMAIL

$ python stderr.py 2>&1 /var/log/test 2> /dev/null | mail -s ‘yo’ jjest@uw.edu

SENDS STDERR TO EMAIL

$ python stderr.py 2>&1 /var/log/test 1> /dev/null | mail -s ‘yo’ jjest@uw.edu

 
SMTP dialog:

This is a sample of the dialog an e-mail client makes when connecting to an SMTP server for sending mail:

   telnet server-name 25     - SMTP communicates on port 25. See: /etc/services
   HELO your-domain          - This identifies the source of the mail.
   HELP                      - List the SMTP commands that are supported. (Included FYI and not part of a typical dialog)
   MAIL FROM: <your-email-address>
   RCPT TO: <recipient-email-address>
   DATA                      - End of DATA section is punctuated with a single dot on it's own line.
   Subject: E-mail-Subject
   Text of e-mail goes here
   .                         - The single dot
   QUIT
 

It is a good idea in Ubuntu to mount a disk by UUID instead of the device since devices (/dev/sd*) are known to change.  Here is how…

root@drvault:~# ls -la /dev/disk/by-uuid/ | grep data
lrwxrwxrwx 1 root root  24 2011-02-22 09:46 4596e922-5863-409e-ba9a-ddefcc7bc604 -> ../../mapper/data-backup

Add line to /etc/fstab

UUID=4596e922-5863-409e-ba9a-ddefcc7bc604 /data         ext4    defaults 0 0

Test mount…

mount -av

Done!

 

 Exclude multiple files and directories at the same time

When you want to exclude multiple files and directories, you can always specify multiple rsync exclude options in the command line as shown below.

$ rsync -avz --exclude file1.txt --exclude dir3/file4.txt source/ destination/

Wait. What if I had tons of files that I want to exclude from rsync?

I can’t keep adding them in the command line using multiple –exclude, which is hard to read, and hard to re-use the rsync command for later.

So, the better way is to use rsync –exclude-from option as shown below, where you can list all the files (and directories) you want to exclude in a file.

First, create a text file with a list of all the files and directories you don’t want to backup. This is the list of files and directories you want to exclude from the rsync.

$ vim exclude-list.txt
file1.txt
dir3/file4.txt

Next, execute the rsync using –exclude-from option with the exclude-list.txt as shown below.

$ rm -rf destination

$ rsync -avz --exclude-from 'exclude-list.txt' source/ destination/
building file list ... done
created directory destination
./
file2.txt
dir1/
dir1/dir2/
dir1/dir2/file3.txt
dir3/

Verify the desitination directory to make sure the files and directories listed in the exclude-list.txt file is not backed-up.

$ find destination
destination
destination/file2.txt
destination/dir1
destination/dir1/dir2
destination/dir1/dir2/file3.txt
destination/dir3
Ref: http://www.thegeekstuff.com/2011/01/rsync-exclude-files-and-folders/?utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+TheGeekStuff+%28The+Geek+Stuff%29
 

You should have atleast half the amount of space for your swap file as you do for physical memory.

root@drvault:/data# sudo dd if=/dev/zero of=/1gb.swap bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 9.46563 s, 113 MB/s

root@drvault:/data# mkswap /1gb.swap
mkswap: /1gb.swap: warning: don’t erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=387ac3e8-64c7-4010-9f20-4e38b443762d

sudo swapon /1gb.swap

/1gb.swap  none  swap  sw  0 0

reboot
root@drvault:~# cat /proc/meminfo | grep Swap*
SwapCached:            0 kB
SwapTotal:       1048568 kB
SwapFree:        1048568 kB

 Add to top of /etc/rc.local script.

#swap file
mkswap /1gb.swap
swapon /1gb.swap

Now verify your memory. Reboot and test.

root@drvault:~# free
             total       used       free     shared    buffers     cached
Mem:       6194152     146112    6048040          0      15596      46528
-/+ buffers/cache:      83988    6110164
Swap:      5242872          0    5242872

You can also add to /etc/fstab

/1gb.swap       none    swap sw 0 0

 

#!/bin/bash

PREV_TOTAL=0
PREV_IDLE=0

###
#added by jj
###

#If less then cpu threshold than will
#perform backup, else loop until true.
CPU_THRESHOLD=5

#current date
DATE=$(/bin/date +%d-%m-%y)

####

while true; do
  CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
  unset CPU[0]                          # Discard the "cpu" prefix.
  IDLE=${CPU[4]}                        # Get the idle CPU time.

  # Calculate the total CPU time.
  TOTAL=0
  for VALUE in "${CPU[@]}"; do
    let "TOTAL=$TOTAL+$VALUE"
  done

  # Calculate the CPU usage since we last checked.
  let "DIFF_IDLE=$IDLE-$PREV_IDLE"
  let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL"
  let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10"
  #echo -en "\rCPU: $DIFF_USAGE%  \b\b"

  # Remember the total and idle CPU times for the next check.
  PREV_TOTAL="$TOTAL"
  PREV_IDLE="$IDLE"

  # Wait before checking again.
  sleep 1

  #added by jj
  if [ "$DIFF_USAGE" -lt "$CPU_THRESHOLD" ]
        then
                echo "CPU usage below $CPU_THRESHOLD%. Backing up now.."
                sleep 2

                #Perform backup.
                tar -czvf /vol03/backups/stone-archive-$DATE.tar.gz /vol03 /homes /etc

                #quit script.
                echo "Backup is complete."

                #delete old archives if approximately a month old
                REMOVE=$(find /vol03/backups/ -name *.tar.gz -atime +28 -exec rm {} \;)

                exit
  fi
done
 

Once you have nagios configured you can setup a failover setup where if the nagios master is offline then a standby slave will enable notifications and checking. Here are the setup notes and as custome script i wrote in pythong to achieve this.

the following command checks if nagios is running locally

[root@scrappy nagios]# /usr/local/nagios/libexec/check_nagios -F /usr/local/nagios/var/status.dat -e 1 -C ‘/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg’

NAGIOS OK: 1 process, status log updated 5 seconds ago

now, set in nrpe config as following on remote slave/master to verify is running. must restart nrpe on machine installed on to reread nrpe.cfg

command[check_nagios_failover]=/usr/local/nagios/libexec/check_nagios -F /usr/local/nagios/var/status.dat -e 1 -C ‘/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg’

test nrpe remote command.

[root@scrappy nagios]# /usr/local/nagios/libexec/check_nrpe -H james -c check_nagios_failover

NAGIOS OK: 15 processes, status log updated 0 seconds ago

modify nagios.cfg on nagios slave. restart nagios.

execute_service_checks=0

enable_notifications=0

check_external_commands=1

now set crontab on slave to check for master failure.

[root@scrappy etc]# crontab -l

* * * * * nagios /usr/local/nagios/set_slave_status.py > /dev/null

Create script and modify master ip.

#!/usr/bin/python
import os
import commands
import sys

master='james'
slave='scrappy'

tmp_file='/tmp/nagios-failover-state.txt'
commandfile='/usr/local/nagios/var/rw/nagios.cmd'
now=commands.getoutput('date +%s')

<a href="mailto:email='email@domain.com'">email='</a><a href="mailto:email@domain.com">email@domain.com</a>'
out=commands.getoutput('/usr/local/nagios/libexec/check_nrpe -H '+master+' -c check_nagios_failover')

#if not 0, then master is down.
master_return_val=out.find('OK')
#store state information
def failover_save_state(x):
fh=open(tmp_file,'w')
fh.write(x)
fh.close()

def sync_nagios_files():
     os.system('rsync -av '+master+':/usr/local/nagios/etc/objects/* /usr/local/nagios/etc/objects/')
     os.system('/etc/init.d/nagios reload')
     print "Master conf files synced with Slave."

     #read current state information
     fh=open(tmp_file,'r')
     current_state=fh.readlines()
     fh.close()

     current_state=current_state[0]
     #enable or disable checks for hosts
     #print current_state

if master_return_val &lt;= 0 and current_state is not 'enabled':
     if current_state=='enabled':
          print "Nagios slave ("+slave+") is active. Nagios master ("+master+") is down. No state change"

     else:
          os.system('/usr/bin/printf "[%lu] ENABLE_NOTIFICATIONS\n" '+now+' &gt; '+commandfile)
          os.system('/usr/bin/printf "[%lu] START_EXECUTING_HOST_CHECKS\n" '+now+' &gt; '+commandfile)
          os.system('/usr/bin/printf "[%lu] START_EXECUTING_SVC_CHECKS\n" '+now+' &gt; '+commandfile)
          os.system('echo elvis has left the building | mail -s "[Nagios] Master Down! Slave Enabled." '+email)
          print "Nagios Failover enabled"
          failover_save_state('enabled')
          sync_nagios_files()

     elif current_state is not 'disabled':
          if current_state=='disabled':
               print "Nagios master ("+master+") is enabled. No state change."
          else:
               os.system('/usr/bin/printf "[%lu] DISABLE_NOTIFICATIONS\n" '+now+' &gt; '+commandfile)
               os.system('/usr/bin/printf "[%lu] STOP_EXECUTING_HOST_CHECKS\n" '+now+' &gt; '+commandfile)
               os.system('/usr/bin/printf "[%lu] STOP_EXECUTING_SVC_CHECKS\n" '+now+' &gt; '+commandfile)
               os.system('echo We are all out of donuts. | mail -s "[Nagios] Master Restored. Slave Disabled." '+email)
               print "Nagios master restored"
               failover_save_state('disabled')

sync_nagios_files()

make executable

[root@scrappy nagios]# chown nagios.nagios /usr/local/nagios/etc/set_slave_status.py
[root@scrappy etc]# chmod o=rwx set_slave_status.py

 

What is faster cp or rsync? Each test is done twice to verify consistency. Let’s find out…

Rsync over NFS

#donkey:~# time rsync -av /mnt/backupserv/10gb /data/10gb
sending incremental file list
10gb

sent 10738729030 bytes  received 31 bytes  41223528.07 bytes/sec
total size is 10737418240  speedup is 1.00

real    4m19.773s
user    1m31.566s
sys     2m23.025s
#donkey:~# time rsync /mnt/backupserv/10gb /data/10gb

real    4m15.026s
user    1m26.453s
sys     2m24.837s

RSYNC direct

#donkey:~# time rsync -av backupserv:/mnt/data/10gb /data/
receiving incremental file list
10gb

sent 30 bytes  received 10738729035 bytes  33401956.66 bytes/sec
total size is 10737418240  speedup is 1.00

real    5m21.004s
user    3m6.644s
sys     2m1.376s

#donkey:~# time rsync -av backupserv:/mnt/data/10gb /data/
receiving incremental file list
10gb

sent 30 bytes  received 10738729035 bytes  32790012.41 bytes/sec
total size is 10737418240  speedup is 1.00

real    5m26.857s
user    3m5.924s
sys     2m8.372s

CP over NFS

#donkey:~# time cp /mnt/backupserv/10gb /data/

real    2m17.176s
user    0m0.024s
sys     0m57.276s

#donkey:~# time cp /mnt/backupserv/10gb /data/

real    2m16.983s
user    0m0.020s
sys     0m57.920s

 

Need to move sample-query.sql into /etc/bacula.

*query
Automatically selected Catalog: MyCatalog
Using Catalog “MyCatalog”
Available queries:
1: List up to 20 places where a File is saved regardless of the directory
2: List where the most recent copies of a file are saved
3: List last 20 Full Backups for a Client
4: List all backups for a Client after a specified time
5: List all backups for a Client
6: List Volume Attributes for a selected Volume
7: List Volumes used by selected JobId
8: List Volumes to Restore All Files
9: List Pool Attributes for a selected Pool
10: List total files/bytes by Job
11: List total files/bytes by Volume
12: List Files for a selected JobId
13: List Jobs stored on a selected MediaId
14: List Jobs stored for a given Volume name
15: List Volumes Bacula thinks are in changer
16: List Volumes likely to need replacement from age or errors
17: List Volumes Bacula thinks are eligible for the changer
18: List Volumes by Volume:
19: List Volumes by Jobs:
20: List Volumes for a jobname:

 

Update file that already exists in tar archive
[root@james ~]# tar -uvf ./test.tar updatefile
Append file that doesnt not exist to archive.
[root@james ~]# tar -rvf ./test.tar newfilesfile
Extract one file from archive.
[root@james ~]# tar -xvf ./test.tar somefile

 

 

Search for a package

apt-cache search <phrase>

Install a package

apt-get install <package>

Upgrade kernel

apt-get dist-upgrade

 

Create a new file using touch and modify its access time.

Set the date to Feb 1st, 2009 @ 730am.

[root@stone backups]# touch testfile2 -t 200902010730 testfile2

Verify settings..
[root@stone backups]# ls -la | grep testfile2
-rw-r–r–  1 root katze          0 Feb  1  2009 testfile2
 

Add rule

root@firefly:/data/music# ufw allow from 10.200.80.132 to any port 3689

Delete rule by line number.

root@firefly:/data/music# ufw delete 1
Deleting:
allow 3689
Proceed with operation (y|n)? y
Rule deleted


View current rules

root@firefly:/data/music# ufw status
Status: active

To                         Action      From
–                         ——      —-
22                         ALLOW       Anywhere
21                         ALLOW       Anywhere
3689                       ALLOW       10.200.80.132

 
#!/usr/bin/python

def main():
salary1 = input("Enter Salary #1: ")
salary2 = input("Enter Salary #2: ")

# SET GLOBAL TO SHARE VARS
global x
global y

if(salary1 < salary2):
x=salary1
y=salary2
else:
y=salary1
x=salary2

def make_percent():
global total

total = 100-(float(x)/float(y)*100)
total=int(round(total,0))
print "Total Difference:",total,"%"

main()
make_percent()

root@donkey:~/tech/core# python calc_number_diff.py
Enter Salary #1: 75
Enter Salary #2: 76
Total Difference: 1 %

 

Install packages

apt-get install lvm2 dmsetup mdadm reiserfsprogs xfsprogs

Create partitions

fdisk /dev/sda

-create new partition (‘n’)
-change system partition type to lvm (‘t’)
-enter ’8e’ for hex partition type
-write partition table to disk (‘w’)

Create physical volume

root@backupserv:~# pvcreate /dev/sdb1 /dev/sda2 /dev/sdc1
Can’t open /dev/sdb1 exclusively.  Mounted filesystem?
Wiping software RAID md superblock on /dev/sda2
Physical volume “/dev/sda2″ successfully created
Wiping software RAID md superblock on /dev/sdc1
Physical volume “/dev/sdc1″ successfully created

root@backupserv:~# pvdisplay
“/dev/sda2″ is a new physical volume of “903.57 GB”
— NEW Physical volume —
PV Name               /dev/sda2
VG Name
PV Size               903.57 GB
Allocatable           NO
PE Size (KByte)       0
Total PE              0
Free PE               0
Allocated PE          0
PV UUID               zsP1EO-SlwB-nryo-gEP7-fInc-hJc4-ytVpLX

“/dev/sdc1″ is a new physical volume of “931.51 GB”
— NEW Physical volume —
PV Name               /dev/sdc1
VG Name
PV Size               931.51 GB
Allocatable           NO
PE Size (KByte)       0
Total PE              0
Free PE               0
Allocated PE          0
PV UUID               V3RZ2b-FBsM-HoI6-aQED-ouu9-LpR1-m02VLO

Create a Volume Group
root@backupserv:~# vgcreate data /dev/sdc1 /dev/sda2
Volume group “data” successfully created

root@backupserv:~# vgdisplay
— Volume group —
VG Name               data
System ID
Format                lvm2
Metadata Areas        2
Metadata Sequence No  1
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                0
Open LV               0
Max PV                0
Cur PV                2
Act PV                2
VG Size               1.79 TB
PE Size               4.00 MB
Total PE              469780
Alloc PE / Size       0 / 0
Free  PE / Size       469780 / 1.79 TB
VG UUID               XJVXrA-m5xO-GARp-6WT0-JFlX-7ARj-jxJChV

root@backupserv:~# vgscan
Reading all physical volumes.  This may take a while…
Found volume group “data” using metadata type lvm2fdisk /dev/sda

Create Logical Volume

root@backupserv:~# lvcreate –name share1 –size 100G data
Logical volume “share1″ created
root@backupserv:~# lvcreate –name share2 –size 500G data
Logical volume “share2″ created

*run lvscan for new logical volume scan.

Format partition

root@backupserv:~# mkfs.ext3 /dev/data/share1
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
6553600 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: 192/800

Mount device

root@backupserv:~# mkdir /mnt/share2
root@backupserv:~# mount /dev/data/share2 /mnt/share2
/dev/mapper/data-share2
516061624    202652 489644572   1% /mnt/share2

Deleting an Volume Group

root@backupserv:~# vgremove data
Do you really want to remove volume group “data” containing 2 logical volumes? [y/n]: yes
Can’t remove open logical volume “share1″
root@backupserv:~# umount /mnt/share*
root@backupserv:~# vgremove data
Do you really want to remove volume group “data” containing 2 logical volumes? [y/n]: yes
Do you really want to remove active logical volume “share1″? [y/n]: yes
Logical volume “share1″ successfully removed
Do you really want to remove active logical volume “share2″? [y/n]: yes
Logical volume “share2″ successfully removed
Volume group “data” successfully removed

Delete Physical Volume

root@backupserv:~# pvremove /dev/sdc1 /dev/sdb1
Labels on physical volume “/dev/sdc1″ successfully wiped
Physical Volume /dev/sdb1 not found

ref: http://www.howtoforge.com/linux_lvm_p2

Adding Additional Disk to LVM

create fdisk LVM partition first….

root@backupserv:~# pvcreate /dev/sdb1
Physical volume “/dev/sdb1″ successfully created

root@backupserv:~# vgextend vol1 /dev/sdb1
Volume group “vol1″ successfully extended
root@backupserv:~# vgdisplay vol1
— Volume group —
VG Name               vol1
System ID
Format                lvm2
Metadata Areas        3
Metadata Sequence No  5
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                1
Open LV               1
Max PV                0
Cur PV                3
Act PV                3
VG Size               2.70 TB
PE Size               4.00 MB
Total PE              708246
Alloc PE / Size       469238 / 1.79 TB
Free  PE / Size       239008 / 933.62 GB
VG UUID               RS2K3i-SOJ8-a230-fcQL-8PX0-Bpuj-qSUYKz

root@backupserv:~# lvextend -L +930G /dev/vol1/data1 /dev/sdb1
Extending logical volume data1 to 2.70 TB
Logical volume data1 successfully resized

root@backupserv:~# resize2fs /dev/vol1/data1
resize2fs 1.41.9 (22-Aug-2009)
Filesystem at /dev/vol1/data1 is mounted on /mnt/data; on-line resizing required
old desc_blocks = 115, new_desc_blocks = 173
….

*watch more space become available with ‘watch df -h’

 

‘-exec’ using trailing ‘\’

[root@monk ~]# tar -cvf test.tar install.log
install.log
[root@monk ~]# time find /tmp/conf-2-xp -name *.xad -exec tar –append –file=/root/test.tar {} +;
find: /tmp/conf-2-xp/9a2f6257887d6e51f58ce2/amd64: Permission denied
find: /tmp/conf-2-xp/9a2f6257887d6e51f58ce2/i386: Permission denied
find: /tmp/conf-2-xp/System Volume Information: Permission denied
tar: Removing leading `/’ from member names

real    0m15.239s
user    0m0.464s
sys     0m2.628s
[root@monk ~]# du -h test.tar
310M    test.tar
[root@monk ~]# rm -f test.tar

*delete fiel and recreate since we are appending and comparing file size after each run.

‘-exec’ using trailing ‘+’

[root@monk ~]# tar -cvf test.tar install.log
install.log
[root@monk ~]# time find /tmp/conf-2-xp -name *.xad -exec tar –append –file=/root/test.tar {} \;
find: /tmp/conf-2-xp/9a2f6257887d6e51f58ce2/amd64: Permission denied
find: /tmp/conf-2-xp/9a2f6257887d6e51f58ce2/i386: Permission denied

real    0m39.015s
user    0m2.739s
sys     0m21.893s
[root@monk ~]# du -h test.tar
310M    test.tar

Using xargs.

*use -print0 option to prevent whitespace issue. ‘xargs -0′ passes first argument.

[root@monk ~]# rm test.tar
rm: remove regular file `test.tar’? yes
[root@monk ~]# tar -cvf test.tar install.log
install.log
[root@monk ~]# time find /tmp/conf-2-xp -name ‘*.xad’ -print0 | xargs -0 tar –append –file=/root/test.tar;
find: /tmp/conf-2-xp/9a2f6257887d6e51f58ce2/amd64: Permission denied
find: /tmp/conf-2-xp/9a2f6257887d6e51f58ce2/i386: Permission denied
find: /tmp/conf-2-xp/System Volume Information: Permission denied
tar: Removing leading `/’ from member names

real    0m15.073s
user    0m0.446s
sys     0m2.774s
[root@monk ~]# du -h test.tar
310M    test.tar

Result: Using ‘+’ is two times faster than using ‘\’. -exec and xargs are about the same speed, when using ‘+’ for -exec.

 

Enabling Caching

*verify caching is on. if need to update, then restart.

jesterj@jesterj-laptop:/etc/mysql$ grep "query" /etc/mysql/my.cnf
query_cache-type = 1 #cache everything
query_cache_limit = 1M
query_cache_size = 16M

*Note that variables in the my.cnf file are reflecteed in the below variables.

mysql> SHOW VARIABLES LIKE '%query_cache%';
+------------------------------+----------+
| Variable_name | Value |
+------------------------------+----------+
| have_query_cache | YES |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 16777216 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
+------------------------------+----------+
6 rows in set (0.00 sec)

View the query cache

mysql> SHOW STATUS LIKE '%qcache%';
+-------------------------+----------+
| Variable_name | Value |
+-------------------------+----------+
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 16612448 |
| Qcache_hits | 1 |
| Qcache_inserts | 2 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 110 |
| Qcache_queries_in_cache | 2 |
| Qcache_total_blocks | 6 |
+-------------------------+----------+
8 rows in set (0.00 sec)

Now run test queries for a database so we can test query cache..

mysql> select * from test.data order by name ASC
mysql> select * from test.data order by name DESC

Notice as you run more and more queries the available free memory descreases and the queries in cache number increases

mysql> SHOW STATUS LIKE '%qcache%';
+-------------------------+----------+
| Variable_name | Value |
+-------------------------+----------+
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 16534728 |
| Qcache_hits | 5 |
| Qcache_inserts | 3 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 110 |
| Qcache_queries_in_cache | 3 |
| Qcache_total_blocks | 8 |
+-------------------------+----------+
8 rows in set (0.00 sec)

Demand Query Caching

You can also specify query cache on demand so only queries that you specify
are cached.

Change query cache type to 2.

[mysql]
....
query-cache-type = 2
....

Restart mysql.

sudo /etc/init.d/mysql restart

Now log back into mysql and verify that DEMAND caching is set

mysql> SHOW VARIABLES LIKE '%query_cache%';
+------------------------------+----------+
| Variable_name | Value |
+------------------------------+----------+
| have_query_cache | YES |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 16777216 |
| query_cache_type | DEMAND |
| query_cache_wlock_invalidate | OFF |
+------------------------------+----------+
6 rows in set (0.00 sec)

Now specify SQL_CACHE when you run a statemnt.

mysql> select SQL_CACHE * from test.data order by name ASC

Note that you can also use SQL_NO_CACHE when query-cache-type=1 to turn off caching for a particular sql stmt.

 

Create the procedure.

mysql> CREATE PROCEDURE donkey() SELECT * FROM data WHERE name LIKE '%64%';
Query OK, 0 rows affected (0.00 sec)

Execute the procedure.


mysql> CALL donkey();
+-----+------------+
| id | name |
+-----+------------+
| 31 | 1265397164 |
| 99 | 1265402640 |
| 100 | 1265402641 |
| 101 | 1265402642 |
| 102 | 1265402643 |
| 103 | 1265402644 |
| 104 | 1265402645 |
| 105 | 1265402646 |
| 106 | 1265402647 |
| 107 | 1265402648 |
| 108 | 1265402649 |
| 122 | 1265402664 |
| 219 | 1265402764 |
| 316 | 1265402864 |
| 479 | 1265404564 |
| 553 | 1265404640 |
| 554 | 1265404641 |
| 555 | 1265404642 |
| 556 | 1265404643 |
+-----+------------+
19 rows in set (0.00 sec)

Display the query.

mysql> SHOW CREATE PROCEDURE donkey2\G;
*************************** 1. row ***************************
Procedure: donkey2
sql_mode:
Create Procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `donkey2`()
SELECT * FROM data WHERE name LIKE '%3%'
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ci
1 row in set (0.00 sec)
ERROR:
No query specified

Delete the procedure.

mysql> DROP PROCEDURE donkey;
Query OK, 0 rows affected (0.00 sec)

 

The following is an overview of how to edit standard files, the directory structure and how to enable site features in apache2. Let’s first dig into the folders that comprise apache2.

Files

$tree -d /etc/apache2 #only show dirs
/etc/apache2/
|– conf.d
|– mods-available
|– mods-enabled
|– sites-available
`– sites-enabled

Let’s define the functions of each.

conf.d – configuration files for modules, etc.
mods-available – list of available modules for apache
mods-enabled – list of modules that are loaded into apache config
site-available – configuration files for virtual hosts
sites-enabled – ?

Files also listed in /etc/apache2…

|– apache2.conf
|– envvars
|– httpd.conf
|– magic
`– ports.conf

Enabling and Disabling Modules

First, check the available modules on your system.

/etc/apache2/mods-available/
|– actions.conf
|– actions.load
|– alias.conf
|– alias.load
|– asis.load
|– auth_basic.load
|– auth_digest.load
|– authn_alias.load
|– authn_anon.load
|– authn_dbd.load
…..

To view all mods enabled view the mods-enabled dir. Note that these are sym linked to the mods-avialable directory.

/etc/apache2/mods-enabled
|– alias.conf -> ../mods-available/alias.conf
|– alias.load -> ../mods-available/alias.load
|– auth_basic.load -> ../mods-available/auth_basic.load
|– authn_file.load -> ../mods-available/authn_file.load
|– authz_default.load -> ../mods-available/authz_default.load
|– authz_groupfile.load -> ../mods-available/authz_groupfile.load

Let’s say we want to enable ‘mod-security’. The best way to do this on ubuntu/debian is to use ‘a2enmod’ utility, which stands for apache2 enable module.

jesterj@jesterj-laptop:/etc/apache2$ sudo a2enmod ssl
Enabling module ssl.
See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and create self-signed certificates.
Run '/etc/init.d/apache2 restart' to activate new configuration!

Note: You can also just type ‘a2enmod’ to list all available modules.

Now restart apache.

jesterj@jesterj-laptop:/etc/apache2$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2 ... waiting [ OK ]

Now, verify the module is available.

jesterj@jesterj-laptop:/etc/apache2$ ls -la /etc/apache2/mods-enabled/ | grep ssl
lrwxrwxrwx 1 root root 26 2010-02-08 19:20 ssl.conf -> ../mods-available/ssl.conf
lrwxrwxrwx 1 root root 26 2010-02-08 19:20 ssl.load -> ../mods-available/ssl.load

To disable a module, do the same thing but use ‘a2dismod’.

Configuring Sites

 

For some reason after setting up replication the root password on both master and slave were cleared. This has happened more than once. Note that i can access mysql via…

$mysql -u root -p
mysql>

Of course this is not desirable. Simply reset the password on the master and the table propegates to the slave and fixes the problem.

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

 

1. Create a new copy of the /etc/mysql/my.cnf file called my2.cnf. The new file should have the following configurations.

[client]
port = 3307
socket = /var/run/mysqld2/mysqld.sock

[mysqld_safe]
socket = /var/run/mysqld2/mysqld.sock
nice = 0

[mysqld]
user = mysql
pid-file = /var/run/mysqld2/mysqld.pid
socket = /var/run/mysqld2/mysqld.sock
port = 3307
basedir = /usr
datadir = /var/lib/mysql2
tmpdir = /tmp>

2. Create copy of /var/lib/mysql to /var/lib/mysql2 (data dir)

mkdir mysql2; cp -a mysql/* mysql2

3. create /var/run/mysqld2 dir. should be owned by mysql. (where pid and sock files are)

chown mysql:mysql /var/run/mysqld2

4. Then call mysqlmanager with the defaults file. Best to just modify the /etc/init.d/mysql2 file as a shell script and call directly!

mysqlmanager --defaults-file=/etc/mysql/my2.cnf --log=/var/log/mysqlmanager.log --pid-file=/var/run/mysqld2/mysqld.pid --angel-pid-file=/var/run/mysqld2/mysqlmanager.angel.pid --run-as-service --user=mysql

*create the mysqlmanager.log file.

sudo touch /var/log/mysqlmanager.log
sudo chown mysql:mysql mysqlmanager.log

5. Login to your new instance. Must specify new port and sock file.


root@slave:# mysql -P 3307 --socket=/var/run/mysqld2/mysqld.sock -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 61
Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)

6. Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

Now connect to the new host from 'mytop' to monitor your instance.

mytop -d mysql -P 3307 -S /var/run/mysqld2/mysqld.sock -u root -pPASSHERE

Rinse and repeat for additional mysql instances!

souce: http://www.ducea.com/2009/01/19/running-multiple-instances-of-mysql-on-the-same-machine/

 

-Create a text file with a secret phrase..

jesterj@jesterj-laptop:~$ cat > secret
donkey

-Encrypt file with password:

jesterj@jesterj-laptop:~$ gpg -c secret

-Verify file is encrypted:

jesterj@jesterj-laptop:~$ more secret.gpg
���(�U    �`�#.���ؖ-�$U

-Send to a different system, and test the file.

jesterj@jesterj-laptop:~$ scp secret.gpg jesterj@remotesystem:~
secret.gpg                                    100%   52     0.1KB/s   00:00

-Decrypt the file and enter passphrase.

jesterj@donkey:~$ gpg secret.gpg
gpg: CAST5 encrypted data
Enter passphrase:

-File is decrompressed:

jesterj@donkey:~$ more secret
donkey

Done!

soure: http://www.cyberciti.biz/tips/linux-how-to-encrypt-and-decrypt-files-with-a-password.html

 

To check a files checksum simply run the following command:

jesterj@jesterj-laptop:~$ md5sum file1
f5fa31b4e964cc2a86140bc2a2e11a13  file1

This does a check of the contents of the file and compares to the 128 bit key located in the header of the file.

To check a group of files then you can do the following.

jesterj@jesterj-laptop:~$ md5sum password* > md5checksums.txt
jesterj@jesterj-laptop:~$ md5sum password*
f5fa31b4e964cc2a86140bc2a2e11a13  password
67c2a19b0fb22552a5aa7cdc6ede2634  password.gpg
f5fa31b4e964cc2a86140bc2a2e11a13  password.orig
11b4f8cd65095066a644139500309bad  passwords
3295d069764198d327edeba43f2b301c  passwords.gpg
jesterj@jesterj-laptop:~$ md5sum -c md5checksums.txt
password: OK
password.gpg: OK
password.orig: OK
passwords: OK
passwords.gpg: OK

source:

http://linux.byexamples.com/archives/198/md5-checksum-how-to/

 

jesterj@jesterj-laptop:~$ tar zcvf – donkey* | ssh jesterj@donkey.dnsdojo.com “cat > ~/testarchive3.tar”By far the easiest way to tar a file and send it to a remote location is to simply have two commands on one line. The first to create the tar file, the other to scp the command. In this example, I am not prompted for a passphrase since i have my ssh key saved on the remote server for this user.

Easy:

jesterj@jesterj-laptop:~$ tar -cvf testarchive.tar donkey*; scp testarchive.tar jesterj@remoteserver:~
donkey
donkey1.zip
donkey2.txt
donkey2.zip
donkey.tar
donkey.txt
testarchive.tar                               100%   20KB  20.0KB/s   00:00
jesterj@jesterj-laptop:~$

Pipe the file…More complicated:

jesterj@jesterj-laptop:~$ tar zcvf - donkey* | ssh jesterj@donkey.dnsdojo.com "cat > ~/testarchive3.tar"

source: http://www.cyberciti.biz/faq/howto-use-tar-command-through-network-over-ssh-session/

 

Need to install debian-helper-scripts.

root@pse07:/var/lib# service apparmor off
The program 'service' can be found in the following packages:
* debian-helper-scripts
* sysvconfig
Try: apt-get install <selected package>
bash: service: command not found
root@pse07:/var/lib# sudo apt-get install debian-helper-script
root@pse07:/var/lib# service apparmor stop
Unloading AppArmor profiles : done.

 

In ubuntu there is program called apparmor that verifies certain programs are configured appropriately, mysql included. Just recently the partition that holds all the data (/var/lib/mysql) filed up. Since I was at 100% and this is a production box I needed to fix this quickly. My options were as follows:

1. Setup a sym link from /var/lib/mysql to /home/mysql, move data here OR
2. Simply create a new dir call /home/mysql, move data here

To do this edit /etc/mysql/my.cnf
...
datadir =/home/mysql
#datadir = /var/lib/mysql
...

Save the file and restart mysql and you will get the following error:

root@slave:/etc/mysql# /etc/init.d/mysql2 start
* Starting MySQL database server mysqld [fail]

The problem here is that apparmor is dissallowing mysql from running in any other location than /var/lib/mysql. You will need to edit the apparmor file for mysql.

root@slave:/etc/apparmor.d# grep "/var/lib/mysql" usr.sbin.mysqld
/var/lib/mysql/ r,
/var/lib/mysql/** rwk,

To correct this problem replace all instances of /var/lib/mysql with /home/mysql. Open the file with file and do a search and replace. See that I am escaping the slashes!

:%s /\/var\/lib\/mysql/\/home\/mysql/

Reload appamor and mysql should start up with the new config in your my.cnf file!

root@slave:/etc/apparmor.d# /etc/init.d/apparmor restart
Reloading AppArmor profiles : done.
root@slave:/etc/apparmor.d# /etc/init.d/mysql2 start
* Starting MySQL database server mysqld

 

Who’s connected to my server?

root@donkey:~# netstat -ntla | grep "80"
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp        0      0 192.168.1.5:80          206.169.197.253:20277   ESTABLISHED

Grep port for host.

root@donkey:~# lsof -i tcp:80 | grep "20277"
apache2 20114 www-data    9u  IPv4 9576072       TCP donkey.local:www->206-169-197-253.static.twtelecom.net:20277 (ESTABLISHED)

Kill Connection

kill -9 20114

 

Let’s talk about managing processes. If you want to run a script or scripts and then continue with other tasks while they run w/o using cron then you can use the ‘jobs’ command.

First, let create a script that will run indefinitely so we have time to work with our examples.

#!/usr/bin/python
x=0
while x == 1:
z=1

The above script will loop indefinitely since ‘x’ will never equal 1.

Next, run the script from the command line. Adding a & to the end of the script will send this jobs to the background.

jesterj@jesterj-laptop:~$ python loop.py &
[1] 4221

This sends loop.py to the background  with process id ’4221′. You can view the process id stats by doing the following:

jesterj@jesterj-laptop:~$ ps -ef | grep ’4221′
jesterj   4221  3083 99 16:37 pts/1    00:02:40 python loop.py

To view all jobs running in the background type ‘jobs’.

jesterj@jesterj-laptop:~$ jobs
[1]+  Running                 python loop.py &

To add another instance of the script to the background, repeat.

jesterj@jesterj-laptop:~$ python loop.py &
[2] 4333
jesterj@jesterj-laptop:~$ jobs
[1]-  Running                 python loop.py &
[2]+  Running                 python loop.py &

To quit the process use kill and the job number.

jesterj@jesterj-laptop:~$ kill %1
jesterj@jesterj-laptop:~$ jobs
[1]-  Terminated              python loop.py
[2]+  Running                 python loop.py &

To bring a process out of jobs to the foreground use, fg:

jesterj@jesterj-laptop:~$ fg %2
python loop.py

 

Basic Commands

:w  – write file

:wq – write and quit

:q! – exit, ignore changes

:set number – show line numbers

:set nonumber – turn off line numbers.


Text Mode

dd – Delete lines

2dd – delete 2 lines

p  – paste buffer lines

w – skip to mext word

a – append after cursor

i – insert at cursor

o – open new line after current line

r – replace character.

yy – yank current line

Searching

/string – search forward for string

?string – search back for string.

/tel[a-z] – search for ‘tel’ with last letter a-z

Find and Replace – ‘g’ stand for global, all lines in document.

:s/OLDWORD/NEWWORD/g

Search and replace,escaping slashes.

To replace the phrase /var/lib/mysql with /home/mysql you need to escape each ‘/’ with a ‘\’. For example…

:%s/\/var\/lib\/mysql/\/home\/mysql/

Regular Expressions

/Hello/ – search for word ‘Hello’ in line.

/^Hello$/ – search and matches if Hello is only word on line.

Recording Macros

qv – start record mode for macro ‘a’. second letter should be lower case character.

q – stop record

@v – to paste recorded text

9 @v – repeat v macro 9 times.
Save Settings

You can save persistent changes for vi by editing ~/.exrc

set number
….

 

>>>import os,tarfile

>>> tarfile=tarfile.open(‘/data/archive-1-1-1.tgz’,'r’)
>>> for x in tarfile:
…     print x

<TarInfo ‘./tmp/’ at 0xb7d9588c>
<TarInfo ‘./tmp/biteoff/’ at 0xb7d9558c>
<TarInfo ‘./tmp/biteoff/bite_offload.tgz’ at 0xb7d959cc>
<TarInfo ‘./tmp/biteoff/aesid.log’ at 0xb7d95a2c>
<TarInfo ‘./tmp/biteoff/lruid.xml’ at 0xb7d95a8c>
<TarInfo ‘./tmp/biteoff/BITEdump.sql’ at 0xb7d95aec>
<TarInfo ‘./tmp/biteoff/offload.cfg’ at 0xb7d95b4c>

ZIP

>>> import os, zipfile
>>> zipfile=zipfile.ZipFile(‘/home/jesterj/foo.zip’,'r’)
>>> for x in zipfile.namelist():
…     print x

index.php

 

If you connect to vncserver and get a blank grey screen with a consol window then this means that the ~/.vnc/xstartup script is not initializing the windows manager correctly.

For ubuntu, edit the script (comment out lines) to the following…

#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
export XKL_XMODMAP_DISABLE=1 #require for proper keyboard mapping
gnome-session
#twm &
\
Then, run ‘vncserver’ to create a new session based on the above script!

 

The below command will show all files, recrusively for the phrases “phrase1″ and “phrase2″ in the / filesystem.

$ sudo grep -rl “phrase1\|phrase2″ /

 

Setup Squid for Linux

Internet Browser Client Setup

Firefox > preferences > settings > Manual Proxy Configuration

IP: (ip for squid server) PORT: 3128 (defautol squid port)

Squid Server Setup

apt-get install squid3
pico /etc/squid3/squid.conf

Add the following…

acl client1 src 10.10.10.2/255.255.255.0
http_access allow client1

Restart squid.

Install SARG reporting tool

sudo apt-get install sarg
edit /etc/squid/sarg.conf
modify squid log file location to:
/var/log/squid3/access.log

run ‘sarg’

look in /var/www/squid-reports for html files of acces logs!

Works!

 

If you have a script that you want to setup at varying time intervals, including but not limited to certain days of the week or specific hours in a day then those commands should go in /etc/crontab.

However, if you want to simply run your script on an hourly or daily basis you can simply put a sym link in /etc/cron.daily or hourly.

Best way to do this is put your actual script in /usr/bin and create a sym link in the appropriate cron directory.

/etc/cron.daily$ sudo ln -s /usr/bin/memcache_save_data.py ./memcache_save_data

Bingo! No more to do. /etc/crontab runs all files in this folders automatically

Note: Cron does not allow you to have file extensions on files in /etc/cron dirs. Also, if you need to pass parameters to the script then you need to run this in /etc/crontab as there is no way to specify these with the above option.

 

If you are unable to get the proper permissions/access on your system because of a shared hosting environment then you may just want to dump your local database and send it to a remote server. This is a simple way to setup a daily copy.

1. Create user called ‘remote’ on the slave (destination for backup) that you can access from the master (the data that needs to be backed up)

mysql> GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* to remote@'MASTERIPADDRESS' IDENTIFIED BY 'PASSHERE';
Query OK, 0 rows affected (0.07 sec)

mysql> flush privileges;

Note:
*REPLICATION CLIENT Gives the right to the user to ask where the slaves/masters are.
*REPLICATION SLAVE Needed for the replication slaves (to read binlogs from master).

IMPORTANT! – Make sure /etc/mysql/my.cnf bind-address is not 127.0.0.1 – if so comment. If change, you will need to restart mysql.

2. Verify you can connect from the master to the slave.

# mysql -h ipaddresstoslave -u remote -p

3. Create a script to run the commands.

#!/usr/bin/python
import os
import datetime
file='mysql-dump-all-%s.sql' % (datetime.date.today())
print "Creating backup file..."
os.system('mysqldump --all-databases -u jester_root -pREMOTEPASS > ~/'+file)
print "Dumping to titan..."
os.system('mysql -h IPTOSLAVE -u remote -pREMOTEPASS < ~/'+file)
print "Deleting local sql file..."
os.system('rm ~/'+file)

4. Add file to cron

Done!

 

What is replication and what should it is and what it isnt…

Master-Master – synchronous replication where each server updates one another.

Pros: Used for hot standby situation. Write to one master only to avoid primary key collisions.
Cons: Network intensive.

Master-Slave – Primary used to share the load. Writes go to master from client,reads go to slave.

Pros: Asyncronous updates (one way) Simple, inexpensive. Hot cache from slave.
Cons: Not good for heavy write loads.

source: http://www.mysqlperformanceblog.com/2009/11/13/finding-your-mysql-high-availability-solution-%E2%80%93-replication/

http://dev.mysql.com/doc/refman/5.1/en/replication.html

How to setup mysql replication

Create new replication user on master.

mysql> GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* to slave@'SLAVEIPADDRESS' IDENTIFIED BY 'PASSHERE';
Query OK, 0 rows affected (0.07 sec)

IMPORTANT!!! – make sure /etc/mysql/my.cnf 127.0.0.1 for bind-address is commented out or cannot connect from the slave!


#bind-address = 127.0.0.1

Now verify can connect from slave:


root@slave:/var/log# mysql -h MASTERIP -P 3306 -u slave -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 60
Server version: 5.1.37-1ubuntu5-log (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>

Configure master.

edit /etc/my.cnf

Add the following.

[mysqld]
...
log-bin=mysql-bin
server-id=1 #master id
...

Make backup of Master.


root@donkey [~]# mysqldump --all-databases -u root -p > mysql-dump-master.sql
Enter password:

Write down the position of the master status for later…

mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 | 106 | | |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

Shudown mysql


root@donkey [~]# sudo /etc/init.d/mysql stop Shutting down MySQL.

Transfter file to Slave.

scp mysql-dump-all-10-15-09.sql root@slave:~

Import Data

root@titan:~# mysql -u root -p < ~/mysql-dump-all-10-15-09.sql
Enter password

Slave /etc/mysql/my.cnf

[mysqld]
server-id = 2
log_bin = mysql-bin.log

Now set master from slave.

mysql> CHANGE MASTER TO MASTER_HOST='205.234.235.89',MASTER_USER='replication_user', MASTER_PASSWORD='PASSHERE',MASTER_LOG_POS=106,MASTER_LOG_FILE='mysql-bin.000001';
Query OK, 0 rows affected (0.00 sec)

*log file and position should be the output from master ‘show master status’; command.
*in need to reset the above then do ‘stop slave’, ‘reset slave’ and issue the CHANGE MASTER TO cmd again.

mysql> start slave
-> ;
Query OK, 0 rows affected (0.00 sec)

Verify Master/Slave are replicating. ‘Slave IO Running’ and ‘Slave SQL Running’ should both be set to “YES”

mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.139.68.174
Master_User: slave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000002
Read_Master_Log_Pos: 43981
Relay_Log_File: mysqld-relay-bin.000005
Relay_Log_Pos: 33858
Relay_Master_Log_File: mysql-bin.000002
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 43981
Relay_Log_Space: 33858
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
1 row in set (0.00 sec)

Check master to see if positon of slave ans master are in sync!

Done!

 

#Grant options: ALL, SELECT, UPDATE, INSERT


mysql> GRANT ALL ON tso_inventory.* to 'jjest'@'%' IDENTIFIED BY 'robin45';
Query OK, 0 rows affected (0.00 sec)

Verify user was added….


mysql> show grants for 'jjest'@'%';
+-----------------------------------------------------------------------------+
| Grants for jjest@% |
+-----------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'jjest'@'%' IDENTIFIED BY PASSWORD '500686d93a92eb7d' |
| GRANT ALL PRIVILEGES ON `ServerInventory`.* TO 'jjest'@'%' |
+-----------------------------------------------------------------------------+
2 rows in set (0.00 sec)

Revoke privs, if needed


mysql> revoke all privileges on ServerInventory.* from 'jjest'@'%';
Query OK, 0 rows affected (0.01 sec)

mysql> show grants for 'jjest'@'%';
+-----------------------------------------------------------------------------+
| Grants for jjest@% |
+-----------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'jjest'@'%' IDENTIFIED BY PASSWORD '500686d93a92eb7d' |
+-----------------------------------------------------------------------------+

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Verify setup…

mysql> select host, password, user from user;

 

Install module

sudo apt-get install libapache2-mod-python

Add python directives to /etc/apache2/sites-enabled/000-default

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>

Restart apache.

sudo /etc/init.d/apache2 restart

Create test page:

def index(req):
return "donkey";

Bingo!

 

Need to convert RPM to DEB

apt-get install alien.

jesterj@1029384756:~$ sudo alien -k ./Desktop/VMware-Player-2.5.3-185404.i386.rpm
Warning: Skipping conversion of scripts in package VMware-Player: postinst prerm
Warning: Use the –scripts parameter to include the scripts.
vmware-player_2.5.3-185404_i386.deb generated
jesterj@1029384756:~$ sudo dpkg -i vmware-player_2.5.3-185404_i386.deb
Selecting previously deselected package vmware-player.
(Reading database … 194000 files and directories currently installed.)
Unpacking vmware-player (from vmware-player_2.5.3-185404_i386.deb) …
Setting up vmware-player (2.5.3-185404) …
jesterj@1029384756:~$

 
< ? PHP
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename='temp.txt'");
readfile("./temp.txt");
?>
 

>>> import time
>>> timestamp=float(’1251157271.796′)
>>> print time.gmtime(timestamp)
time.struct_time(tm_year=2009, tm_mon=8, tm_mday=24, tm_hour=23, tm_min=41, tm_sec=11, tm_wday=0, tm_yday=236, tm_isdst=0)
>>> start_time=time.gmtime(timestamp)
>>> for x in start_time:
…     print x

2009
8
24
23
41
11
0
236
0

 

memcache class  not found in php page.

problem: i’ve install memcache for php, restarted apache but get the follwoing
error…
“Fatal error: Class ‘Memcache’ not found in /var/www/loadscript/index.php on line 2″

resolution: Add this line to php.ini and restart apache

extension=memcache.so

 

$ apt-get install memcached python-memcache

jesterj@jesterj-laptop:~$ python
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>import memcache
>>>memcache = memcache.Client(['10.10.10.45:11211'])
>>>datavar="some data here"
>>>memcache.set('1234',datavar,60)
>>>memcache.get('1234')

‘some data here’

Ref: http://dev.mysql.com/doc/refman/5.1/en/ha-memcached-interfaces-python.html

Do the same above to connect from remote machine…

 

Error uninstalling/installing Ubuntu package.

If you have a problem with a certain package run this…

sudo dpkg -r <packagename>

Then reinstall with apt!

 


Tuple are immutable. Lists are mutable.

a=(1,2,3) #tuples have ()
a[0]=100

Error! Tuple values cannot be changed!

a=[1,2,3] #list have brackets
a[0]=100

success!

Note: dicts have curly braces ie: a={}

 

Unmount the array, i don’t know if this is necessary, but doing so means less stuff to go wrong.
sudo umount /dev/md0

Then you need to go and prepare the disk(s) to be added. (The prepare section of the guide)

Then tell mdadm that it can play with it:
sudo mdadm --add /dev/md0 /dev/sda2

Then tell mdadm to stop playing and use it to expand/grow your raid5 array(make sure that the number of raid devices is correct, it should be the number of disks/partitions the grown/expanded array will have):
sudo mdadm --grow /dev/md0 --raid-devices=4

View and wait for the new array to reshape:
cat /proc/mdstat

Check the filesystem (required to resize it):
sudo e2fsck -f /dev/md0

Resize the filesystem on the new array so that you can use it for something useful.
sudo resize2fs /dev/md0

Mount the expanded/grown array with it’s resized filesystem(remember to change the mount point):
sudo mount -t ext3 /dev/md0 /home/tore/raid

Go check your files:
cd /home/tore/raid
cksfv -r -q

REF: http://ubuntuforums.org/archive/index.php/t-517282.html

 

Install mdadm
apt-get install mdadm

Create the fisrt striped set:

sudo mdadm –create –force /dev/md0 –level=stripe –chunk=4096 –raid-devices=2 /dev/sdc /dev/sdd

Create the second striped set:
sudo mdadm –create –force /dev/md1 –level=stripe –chunk=4096 –raid-devices=2 /dev/sde /dev/sdf

You now have two 2tb striped arrays. We now want to take those and tell mdadm to mirror them w/ Raid 1, hence the
name Raid0+1.

Raid 1 both of your stripe sets

sudo mdadm –create –force /dev/md2 –level=mirror –chunk=4096 –raid-devices=2 /dev/md0 /dev/md1

Partition the drive w/ fdisk

fdisk /dev/md2
-Create a new partition.
-Write to disk

Next, format the new drive

mkfs.ext3 /dev/md2

Finally, mount the drive and use!

mount -t ext3 /dev/md2 /mnt/raid1

View the details of the array…

mdadm -D /dev/md2

$ cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [raid0] [raid1]
md2 : active raid1 md1[1] md0[0]
1953521600 blocks [2/2] [UU]
[===========>.........] resync = 59.3% (1160324480/1953521600) finish=973.8min speed=13574K/sec

md1 : active raid0 sdf[1] sde[0]
1953521664 blocks 4096k chunks

md0 : active raid0 sdd[1] sdc[0]
1953521664 blocks 4096k chunks

unused devices:

 

I wrote up this quick little banking script to illustrate how to do simple object oriented programming in php5 using classes. Functions within a class are known as methods.

-JJ

class account_transact
{
    var $balance;
    var $account_type;
    var $amount;

    function get_bal($account_type)
    {
        if($account_type=='checking')
        {
            #query for sql to look up account
            $balance=100;
        }
        elseif($account_type=='savings')
        {
            #query for sql to look up account
            $balance=25;
        }
        return $balance;
    }
    function verify_account($account_type)
    {
        if($account_type=="checking" || $account_type=="savings")
        {
            #account verified
            return $account_type;
        }
        else
        {
            echo $account_type." is not a valid account";
            exit();
        }
    }
    function deposit($account_type, $amount)
    {
        $cur_bal=$this->get_bal($account_type);
        $new_bal=$cur_bal+$amount;
        print "Balance for <b>".$account_type."</b> is <b>$".$new_bal."</b><BR>";
    }
}

//create new class instance
$transaction=new account_transact();

//checking deposit
$account=$transaction->verify_account("checking");
$transaction->deposit($account,"5");

//savings
$account=$transaction->verify_account("savings");
$transaction->deposit($account,"-10");
?>

More: http://www.php-editors.com/articles/simple_php_classes.php

 

Today i found a better way to kill processes in linux. Use pkill. Now instead of killing items w/ the process id, you can kill items matching a certain pattern, plus lots of extras…

For example, lets say i have a bunch of stagnate processes all spawned from the same script.

root 27623 27622 0 Jun25 ? 00:00:00 /bin/sh -c python /etc/nagios2/scripts/notify_failover.py
root 27625 27623 0 Jun25 ? 00:00:00 python /etc/nagios2/scripts/notify_failover.py
root 27920 27919 0 Jun25 ? 00:00:00 /bin/sh -c python /etc/nagios2/scripts/notify_failover.py
root 27922 27920 0 Jun25 ? 00:00:00 python /etc/nagios2/scripts/notify_failover.py
root 28206 28205 0 Jun25 ? 00:00:00 /bin/sh -c python /etc/nagios2/scripts/notify_failover.py
root 28208 28206 0 Jun25 ? 00:00:00 python /etc/nagios2/scripts/notify_failover.py
root 28730 28729 0 Jun25 ? 00:00:00 /bin/sh -c python /etc/nagios2/scripts/notify_failover.py
root 28732 28730 0 Jun25 ? 00:00:00 python /etc/nagios2/scripts/notify_failover.py
root 29061 29060 0 Jun25 ? 00:00:00 /bin/sh -c python /etc/nagios2/scripts/notify_failover.py

Now, I could kill them by doing this....

kill 27623 27625, etc, etc...

However, the more efficient way to do this would be to do the following...

pkill -f "python /etc/nagios2/scripts/notify_failover.py"

Whamo! All process gone!

 

sudo tcpdump -n -i eth0 -s 0 -w output.txt src or dst port 80

 

-Firefox > Preferences > Manual Proxy configuration > Socks Host: localhost Port: 9999, socksv5.

LINUX:

Next open linux terminal and setup up tunneling.

$ssh -CND 9999 user@remoterserver.com

WINDOWS:

Follow these screen shots…

*Leave terminal window open.

To verify web traffic is coming from the host go to www.whatismyip.com and the server ip should be listed from where data is being tunnelled through!

 
a=set(['apple','apple','orange','apple','pear','berry'])
b=set(['pear','coconut','strawberry'])
a | b

set(['strawberry', 'coconut', 'apple', 'orange', 'pear', 'berry'])

a.union(b)

set(['strawberry', 'coconut', 'apple', 'orange', 'pear', 'berry'])

 

Need to install ‘antiword’ debian package then read output from CLI.

import commands
output=commands.getoutput('antiword /home/jesterj/Desktop/test.doc')
print output

Mary had a little lamb. Mary had a little lamb. Mary had a little lamb.
Mary had a little lamb. Mary had a little lamb. Mary had a little lamb.
Mary had a little lamb. Mary had a little lamb. Mary had a little lamb.
Mary had a little lamb. Mary had a little lamb. Mary had a little lamb.
Mary had a little lamb. Mary had a little lamb. Mary had a little lamb.
Mary had a little lamb. Mary had a little lamb. Mary had a little lamb.
Mary had a little lamb. Mary had a little lamb. Mary had a little lamb.
Mary had a little lamb. Mary had a little lamb. Mary had a little lamb.
Mary had a little lamb. Mary had a little lamb. Mary had a little lamb.
Mary had a little lamb. Mary had a little lamb. Mary had a little lamb.

Write to word…

Pretty easy here. Just write to a file and append with .doc.

f=open("newfile.doc","wr")
f.write(output)
f.close()

Badow!

 

install ‘xlrd’ for reading…
Download: http://www.lexicon.net/sjmachin/xlrd.htm

root@donkey:~# sudo apt-cache search xlrd
python-xlrd – extract data from MS Excel spreadsheet files

import xlrd
wb=xlrd.open_workbook('/home/jesterj/Desktop/JJ-MonthlyNumbersNew-6.18.09.xls')
wb.sheet_names()

[u'Sheet1', u'Sheet2', u'Sheet3']
sh=wb.sheet_by_index(0)
for rownum in range(sh.nrows):
    print sh.row_values(rownum)

Ref: http://scienceoss.com/read-excel-files-from-python/

Install 'xlwt' for writing excel files...
Download: http://pypi.python.org/pypi/xlwt


import xlwt
from datetime import datetime

font0 = xlwt.Font()
font0.name = 'Times New Roman'
font0.colour_index = 2
font0.bold = True

style0 = xlwt.XFStyle()
style0.font = font0

style1 = xlwt.XFStyle()
style1.num_format_str = 'D-MMM-YY'

wb = xlwt.Workbook()
ws = wb.add_sheet('A Test Sheet')

ws.write(0, 0, 'Test', style0)
ws.write(1, 0, datetime.now(), style1)
ws.write(2, 0, 1)
ws.write(2, 1, 1)
ws.write(2, 2, xlwt.Formula("A3+B3"))

wb.save('example.xls')
 

Symmetrical difference calculates the difference of not whats in the just one list. It calculates the items that are not common in both lists!

list1=['donkey','balls']
list2=['donkey','scrotom']
set1=set(list1)
set2=set(list2)
print set1

set(['donkey', 'balls'])

print set2

set(['donkey', 'scrotom'])

symdiff = set1 ^ set2
symdiff

set(['balls', 'scrotom'])

 

There is no way to do a function diff on a list. However you can do a loop.

list1 = [1, 2, 3, 5, 7,  11]
list2 = [1, 2, 4, 8, 16, 32]
diff_list = []
for item in list1:
    if item not in list2:
        diff_list.append(item)

print diff_list
[3, 5, 7, 11]

Or use sets….

from sets import Set
set1=Set(['a','b','c'])
set2=Set(['d','b','c'])
diff=set1-set2
print diff
 

Set(['a'])

for x in diff:
    print x

a

Or conver list to a set…

list1=['a','b']
list2=['b','c']

set1=set(list1)
set2=set(list2)

diff=set1-set2
 
def main():
cases=['auth','transact','dns','network','ssl']
print sys.argv
try:
if sys.argv[1]=='-t':
if sys.argv[2] not in cases or len(sys.argv[2])==0:
print "*Must specify a valid case: %s " % cases
exit()
else:
case=sys.argv[2]

if case=='auth':
test_authentication()
if case=='transact':
test_transaction_problem(transact_url)
if case=='dns':
test_dns(hosts)
if case=='network':
test_network(hosts)
if case=='ssl':
test_ssl(hosts)
else:
print "You must specify a valid test %s" % cases
except:
print "You must specify option -t followed by test option %s" % cases

 

dd if=/dev/zero of=file_to-create bs=1k count=4000000

*the above will create a 4gb file called ‘file_to-create”

 

Using urllib…

#!/usr/bin/python
import urllib
c=urllib.urlopen('http://nike.com')
print c.getcode()

200

or try with httplib…

#!/usr/bin/python
import httplib
conn = httplib.HTTPConnection("www.python.org")
conn.request("GET", "/index.html")
r1 = conn.getresponse()
print r1.status

200

 
#!/usr/bin/python

items=['klm','klm','pia','nwa','klm','al','al','al','ri','pia','klm']

#get unique items from list
get_unique=[]
for a in items:
if a not in get_unique:
get_unique.append(a)

#dict for storage of key,occurence
dict={}

for x in items:
for y in get_unique:
if x in y:
if x in dict:
val=dict[x]
val+=1
dict[x]=val
else:
dict[x]=1

print dict

</code>

 

*NOTE: def() method/function must be defined before it is called. If the def is below where it is called will get a ‘NameError: name ‘donkey’ is not defined’

def donkey():

print “hello”

a=donkey()

 
#!/usr/bin/python
def mylist(a):
fruit=[]
fruit.append(a)
return fruit

b=mylist("donkey")
print b

 
import zipfile

a=zipfile.ZipFile('/path/to/zipfile.ZIP')
for x in a.namelist():
...     if x.endswith('.zip'):
...             info=a.getinfo(x)
...             print "%s %s" % (info.filename, info.file_size)
...

123.zip 4563
254.zip  5435
donkey.zip 8979

 

letterDict = {}
all_letters_list =
['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r'
,'s','t','u','v','w','x','y','z']
test_string = “in mississippimississippimississippimississippi pigs can
fly like the wind”

# saving the dict
for letter in test_string:
letterDict[letter] = letterDict.get(letter, 0) + 1

print letterDict

=========

print ‘-’ * 60
print ‘Examine the line below to see how it worked ‘
print ‘ 1 – inserting:  letterDict[letter] = letterDict.get(letter, 0) +
1  – self initiates with value of 0 and increments +1′
print ‘ 2 -  reading :  letterDict.get(testLetter, 0)  – when reading -
insert a default count of 0 for those letters not found.’
print ‘-’ * 60
print ‘test_string = ‘, test_string
print
print ‘letterDict = ‘, letterDict
print
print ‘Histogram (count) of letters in test string’

# reading the dict, but inserting default 0 for letters not found.
for testLetter in all_letters_list:
print ‘%s – %2s’ % (testLetter, letterDict.get(testLetter, 0))

 
import difflib
a=difflib.get_close_matches
a("Phil Collins", ["Phil Colins","PhilCollins","Phil Collins","Phil Collins - Genesis"])

['Phil Collins', 'PhilCollins', 'Phil Colins']

 

find -depth -type d -empty -exec rmdir {} \;

 

# umount -f /dev/sdb1
umount: /dev/sdb1: device is busy
umount: /dev/sdb1: device is busy
# fuser -m /dev/sdb1
/dev/sdb1: 3322

(3322 is id of the process that uses the device. if you like to know what it is, you may try this:

# ps aux | grep 3322)

# kill -9 3322
# umount /dev/sdb1

Also dmsetup….just lvm mounts?

ls -lh /dev/mapper/
dmsetup remove_all

 
Type "help", "copyright", "credits" or "license" for more information.
import Cfg #class you just created
c = Cfg.Cfg()
c.test()
donkey

from Cfg import Cfg
c = Cfg()
c.test
bound method Cfg.test of <Cfg.Cfg instance at 0xb7ce35ec>>
c.test()
donkey

 

import codecs
someFile=”donkeys.txt”
fileObj = codecs.open(someFile, “r”, “utf-8″ )
u = fileObj.read()
print u

 

>>> path=’/donkey/file.cfg’
>>> var=path.split(‘/’)
>>> print var
['', 'donkey', 'file.cfg']
>>> var[-1]
‘file.cfg’

or can do

>>>varv.pop()
‘file.cfg’

#note you must assign path.split(‘/’) to a string or path.string will
just print out the last letter of the 3rd element which is ‘g’

 

Many times when you parse a file using split() or the csv module you return strings that have garbage characters in the line. Take the below string for example…

>>> badstring=’\xef\xbb\xbf#Some information’
>>> print badstring
#Some information
>>> if badstring.startswith(‘#’):
…     print “Hello”

>>>

The above doesn’t print ‘Hello’ becuase of the garbage data. So we need to create a method to remove the junk chars.

Here is what we do….

def remove_garbage():

 
items=['a','b','c']
size=len(items)

print size

# 3

 

apt-get install python-mutagen

#!/usr/bin/python
from mutagen.mp3 import MP3
import os

for root, dirs, files in os.walk('/mnt/music'):
for name in files:
joined=os.path.join(root, name)
audio=MP3(joined)
if audio.info.bitrate < 128000:
print joined
print audio.info.bitrate

 

$ telnet titan.zipcon.net 22
Trying 63.249.22.50…
Connected to titan.zipcon.net.
Escape character is ‘^]’.
SSH-2.0-OpenSSH_5.1p1 Debian-3ubuntu1

 

w
14:16:50 up 2 days, 23:54,  4 users,  load average: 0.24, 0.16, 0.07
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
jesterj  tty7     :0               Fri14    3days 24:30m  0.30s x-session-manag
jesterj  pts/0    :0.0             14:13    0.00s  0.10s 19.94s gnome-terminal
jesterj  pts/2    :0.0             11:52    2:23   0.20s  0.10s ssh jesterj@pse
jesterj  pts/1    :0.0             11:23    2:34   0.16s  0.06s ssh jesterj@pse

 

$ netstat -nta
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:6024            0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
tcp        0      0 10.139.68.153:42651     10.139.68.39:22         ESTABLISHED
tcp        0      0 10.139.68.153:51346     64.4.34.126:1863        ESTABLISHED
tcp        0      0 10.139.68.153:44434     206.255.61.214:4228     ESTABLISHED
tcp        0      0 10.139.68.153:38705     205.234.235.90:80       ESTABLISHED
tcp        0      0 10.139.68.153:38707     205.234.235.90:80       ESTABLISHED
tcp        0      0 10.139.68.153:40101     64.4.37.39:1863         TIME_WAIT
tcp        0      0 10.139.68.153:38708     205.234.235.90:80       ESTABLISHED
tcp        0      0 10.139.68.153:52217     10.139.10.45:22         ESTABLISHED
tcp        0      0 10.139.68.153:38702     205.234.235.90:80       ESTABLISHED
tcp        0      0 10.139.68.153:38709     205.234.235.90:80       ESTABLISHED
tcp        0      0 10.139.68.153:38710     205.234.235.90:80       ESTABLISHED
tcp6       0      0 :::80                   :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN

 

ubuntu@ubuntu:/mnt$ sudo mount -t ext3 /dev/md0 /mnt/md0

mount: wrong fs type, bad option, bad superblock on /dev/md0,
missing codepage or other error
(could this be the IDE device where you in fact use
ide-scsi so that sr0 or sda or so is needed?)
In some cases useful info is found in syslog – try
dmesg | tail  or so


$ sudo mdadm –assemble /dev/md0 /dev/sdd /dev/sdb /dev/sdc
mdadm: /dev/md0 has been started with 3 drives.

$sudo mount /dev/md0 /data/

OR….

Simply run this command.

mdadm --detail --scan >> /etc/mdadm/mdadm.conf

Mount again and all should work!

 
#!/usr/bin/python
import MySQLdb
data="jeremiah's new  laptop"
data=MySQLdb.escape_string(data)
cursor.execut("INSERT INTO table1 name VALUES (data);")
 
import sys, socket

hostname = socket.gethostname()
print "Host name:", hostname

Neutrogena Skin Id Home Remedies For Acne Does Proactive Really Work

Exposed Skin Care Reviews

Proactive Reviews How To Prevent Acne

Murad Reviews


How To Get Rid of Stretch Marks

Skin Id Reviews

dd
© 2011 OSS Robot Suffusion theme by Sayontan Sinha
Stretch Mark Removal
You guys, michael kors this is clearly not Michael Kors first time at the rodeo, michael kors watches even if it was his first time on safari. michael kors watch Kors used a recent trip to a luxurious South African resort in the middle of a nature reserve to power the michael kors handbags Michael Kors Spring 2012 show at michael kors outletMercedes-Benz Fashion Week New York, and if you re having a hard time seeing the theme in these photos, then you might want to get your eyes checked. From the prints to the proportions to the accessories, Kors¡¯ clothes were as he called it in his show notes. michael kors bags michael kors sale michael kors tote michael kors tote bag Michael Kors Gansevoort Michael Kors Hamilton Michael Kors Jet Set Michael Kors Kingsbury Michael Kors Mini Crossbody Michael Kors Satchel Michael Kors Skorpios

As Heidi Klum says on Project Runway, michael korswhen it comes to fashion, one day you re in and the next day you re out. And when the German supermodel was just starting out in the business at age 20, she was outmichael kors handbagsat least to Michael Kors. michael kors outletThe two "Project Runway" personalities are best buds now, but Klum reveals that was not michael kors bagsalways the case in a new interview with Allure, for which she posed nude. I never did fashionor Berlin or even in New York City ¡­ no one would book me, michael kors saleshe tells the magazine. Klum, now 38, Michael Kors Crossbody Bagsgoes on to recall the time she went on a casting call for Kors. After the fashion designer saw her in one of his creations,Michael Kors Hamilton Handbags he told her tersely, Thanks, but no thanks. Michael Kors Kingsbury Michael Kors Leather Handbags Michael Kors New Arrivals Michael Kors Satchel Michael Kors Tote Bags Michael Kors Wallets

Ahoy there! The Battleship promo tour has officially set sail (ok, ok, more likely private jetted its way over!) and alexander wangyesterday it landed on the shores of London town bringing with it gorgeous young stars, Rihanna and Brooklyn Decker. The film might be all about the fight between the navy and some pesky aliens intent on conquering Earth (eek!) but here at Grazia Daily we're every bit as hooked by the battle alexander wang bagof the red carpet. We're sure RiRi and Brooklyn are the best of budsalexander wang 2012 but we can't resist the opportunity for a bit of style-off! alexander wang 2011We readied our fashion telescopes for a alexander wang dressgood squiz at the style of two alexander wang emilevery different fashionistas. Posing for a photocall atop the alexander wang outletCorinthia Hotel yesterday it was a tough call as to who took the lead. Firing the first shot in this sartorial sortie, alexander wang shoesRihanna! We loved her Alexander Wang dress (nabbed from his Pre Fall 2012 collection), Alexander Wang Handbagsthe appropriately military shade of green suited her alexander wang saledown to the ground, the swathes of material on the skirt softened it slightly but the cut-away Alexander Wang Shoes top ensured it paid homage to the singer's sharp style.

Ahoy there! The Battleship promo tour has officially set sail (ok, ok, more likely private jetted its way over!) and alexander wangyesterday it landed on the shores of London town bringing with it gorgeous young stars, Rihanna and Brooklyn Decker. The film might be all about the fight between the navy and some pesky aliens intent on conquering Earth (eek!) but here at Grazia Daily we're every bit as hooked by the battle alexander wang bagof the red carpet. We're sure RiRi and Brooklyn are the best of budsalexander wang 2012 but we can't resist the opportunity for a bit of style-off! alexander wang 2011We readied our fashion telescopes for a alexander wang dressgood squiz at the style of two alexander wang emilevery different fashionistas. Posing for a photocall atop the alexander wang outletCorinthia Hotel yesterday it was a tough call as to who took the lead. Firing the first shot in this sartorial sortie, alexander wang shoesRihanna! We loved her Alexander Wang dress (nabbed from his Pre Fall 2012 collection), Alexander Wang Handbagsthe appropriately military shade of green suited her alexander wang saledown to the ground, the swathes of material on the skirt softened it slightly but the cut-away Alexander Wang Shoes top ensured it paid homage to the singer's sharp style.

In the world of fashion, which let's face itmarc jacobs , decides what is hip for the rest of the world, there are only two ways to dress. You can marc jacobs 2012 dress to the prevailing trend's current whim, like famed celebrities, or dress to be one of those people whose style rises marc jacobs outlet above the changing trends and is timeless. Any other marc jacobs bags might be the flavor of the month, or week, but a Marc Jacobs handbag is something that stands out from the mass marc jacobs handbags of imitators and knockoffs. With its bold colors and striking styles, Marc Jacobs handbags are made for a woman who prides herself on distinction, by a man who has defined himself for his excellence in design and his eye for fashion forward marc jacobs totestyle. Marc Jacobs shop
Marc Jacobs online shopping
Marc Jacobs Hobo
Marc Jacobs Shoulder
Marc Jacobs Stam
Marc Jacobs Hillier
Marc By Marc Jacobs

What exactly is the Burberry Outlet Store all about? The shop offers a choice of low-priced Authentic Burberry products for men and women. Although many local burberry outlet offer some great deals, many times they will not offer exclusive items or will not have the product in stock. This huge online outlet mall is nothing like the burberry sale that have popped up locally in the U.S. With amazing low-prices and a huge attractive selection, this Burberry shopping center not only have stocks of the latest and hottest burberry online Products, but also offered are vintage and classic products. burberry bags
Burberry Scarf
burberry scarf outlet
burberry 2012
burberry watches
burberry trench coat
trench burberry
If you're into music in a beats by dreserious way, then you want to get the best sound quality that you can. In addition, you want to be able to beats by dre 2012 listen to your music on the move and look good whilst you're beats headphones doing it, right? If this sounds like you, then you'll want to know more about Dr Dre headphones. In this article we take a look at their capabilities and let you know where cheap beats by dre headphones can be found. Monster has managed to combine beats by dre cheap style with functionality in the Dr Dre range of headphones. So often manufacturers sacrifice one for the beats studio other, but not here. Not only do they look good, but the sound quality is good too. dr dre beats
Beats by Dre Headphones
monster headphones outlet
monster headphones beats
Monster Beats Headphones
monster headphones
monster beats
Louis Vuitton handbags have been the most desired bag by women for all time. Louis Vuitton handbags are some of the most expensive bags on the louis vuitton bags market. There are so many styles and designs that will surely make you want at least one.louis vuitton belt Buying Louis Vuitton Speedy handbags for louis vuitton bagyourself can be nearly impossible for some and buying for someone else even harder. louis vuitton sunglassesIf buying one as a gift is your goal you may find the prices a bit steep and out of your budget. When looking for these bags,louis vuitton purses you will find the Speedy louis vuitton handbags one of the most popular.louis vuitton wallet You'll also find it can be bought cheaper online. louis vuitton outlet louis vuitton shoes louis vuitton online
The makersChristian Louboutinof these replica footwear are actual geniuses and they make the replicas so perfectly that anyone can fool his/her friends by making them believe that someone has purchased the real thing.christian louboutin shoes It's really hard to believe that it is a replica.christian louboutin boots However,christian louboutin heels identifying a replica is hard, but not really impossible.christian louboutin online A customer can find out Christian Louboutin fakes if one goes to the store and compares his imperfect replica with the perfect original one.christian louboutin outlet Rather, a customer should be concerned about the original Louboutin signature on the sole of the shoe or check out the size print for more authentications.christian louboutin pumpsThe main customers of this product are mainly the middle and higher middle class people of the society, as they can not really afford the high price tag of the original designer shoes. sale christian louboutinConsidering their income ability,shop christian louboutin it is better to buy an imitation of the originals,christian louboutin 2012 as these replicas are not uncomfortable and they do last almost as long as the real ones. But the one who is looking for his perfect mental satisfaction by buying the original designer made shoes should check out the size conversion before buying; louboutin outletit is available in their website.christian louboutin discountMoreover, discount christian louboutin there are other ways to identify if the shoes are not the original ones. Though the replicas last long and are as comfortable as the originals, they are not made of genuine leathers like the original designer footwear.Christian Louboutin Cheap Besides, this well known designer ensures the brand security by keeping all the shoes in Christian Louboutin dust bags with its own original logo and Christian Louboutin box. Cheap Christian Louboutin A customer should ensure that he is getting all of these from the salesman.
"Quintessentially English"mulberry alexa is a term often used to describe Mulberry bags.mulberry outlet Mulberry first burst onto the scene over thirty years ago and quickly become synonymous with exemplary craftsmanship and stunning creativity and design.mulberry factory shop Added to all this was a healthy dose of practicality enabling Mulberry to become amulberry bag fashion icon and yet not distance itself from the high street shopper.mulberry purse Over the years there have been many different c launched with some being more successful than others. Even the handbags that did not reach the dizzying heights of success as some mulberry bayswaterof Mulberry's best sellers were still very,mulberry sale very well made leather handbags. mulberry ukPerhaps the difference between a well made bag and a well made bag that becomes a global superstar lies in it's design appeal,mulberry london providing the right style at the right time. mulberry handbags
If you're into music in beats by dre a serious way, then you want to get the best sound quality that you can. In addition, you want beats by dre 2012 to be able to listen to your music on the move and look good beats headphones whilst you're doing it, right? If this sounds like you, then you'll want to know more about Dr Dre headphones. In this article we take a look at their capabilities and Beats by Dre Headphones let you know where cheap beats by dre headphones can be found. monster headphones beats
Monster Beats Headphones
monster headphones
monster beats
monster headphones 2012
monster headphones outlet
If you're into music in beats by dre a serious way, then you want to get the best sound quality that you can. In addition, you want beats by dre 2012 to be able to listen to your music on the move and look good beats headphones whilst you're doing it, right? If this sounds like you, then you'll want to know more about Dr Dre headphones. In this article we take a look at their capabilities and Beats by Dre Headphones let you know where cheap beats by dre headphones can be found. monster headphones beats
Monster Beats Headphones
monster headphones
monster beats
monster headphones 2012
monster headphones outlet