Tuesday, May 7, 2013
Sys Admin things...: Keeping your NetApp in check with Nagios
Sys Admin things...: Keeping your NetApp in check with Nagios: Recently we took delivery of a new NetApp. Two 3210′s with roughly 50TB of storage across five disk shelves. For monitoring we use Nagios ...
Thursday, May 2, 2013
Script to check the Forward/Reverse DNS entries are sane for host
#! /bin/bashname=`hostname -f`ip=$(ifconfig eth0 | grep "inet addr" | awk -F '[: ]' '{print $13}')forward=$(host $name | awk -F " address " '{print $2}')reverse=$(host $ip | awk -F "pointer " '{print $2}' | sed 's/\.$//g')if [ "$ip" = "$forward" ]; thenecho -e "Forward Lookup is ok"elseecho -e "\nForward lookup does not match with assigned IP address.IP address is $ip while DNS ponits to $forward."fiif [ "$name" = "$reverse" ]; thenecho -e "\nReverse Lookup is ok"elseecho -e "\nReverse lookup does not match with hostname.Hostname is $name while Reverse DNS ponits to $reverse."fi
Using multiple Field Separators in AWK
Most of the time working with awk we require multiple field separators, e.g. from the o/p of ifconfig you require ip address , BCast address as well netmask you can get all these details in one go as below
Here I am using the white space and colon both as field Separators
ifconfig eth0 | grep 'inet addr:' | awk -F '[: ]' '{print $13,$16,$19}'
Here I am using the white space and colon both as field Separators
Monday, February 4, 2013
Check_MK important how-to's
The official documentation!
http://mathias-kettner.de/checkmk_writing_checks.html
Using Dell OpenManage with Check_MK
http://flakrat.blogspot.com/2011/03/using-checkopenmanage-with-checkmk.html
OMD Installation and Check_MK Configuration at ORCA / Breakable Experimental Network
https://geni-orca.renci.org/trac/wiki/OMDconfiguration
Using Eventhandlers for automatic Inventory & deletion of KVM VMs
https://geni-orca.renci.org/trac/wiki/OMDeventhandlers
Using Check_MK to monitor the "DTC" hosting control panel
http://dtcsupport.gplhost.com/PmWiki/Nagios
Ignoring services based on advanced syntax with explanations:
http://deranfangvomende.wordpress.com/2011/08/31/check_mk-magic-dust-for-ignoring-stuff/
Chris Carmichael's notes and howtos.
http://sysadmin-101.blogspot.de/search/label/checkmk
http://mathias-kettner.de/checkmk_writing_checks.html
Using Dell OpenManage with Check_MK
http://flakrat.blogspot.com/2011/03/using-checkopenmanage-with-checkmk.html
OMD Installation and Check_MK Configuration at ORCA / Breakable Experimental Network
https://geni-orca.renci.org/trac/wiki/OMDconfiguration
Using Eventhandlers for automatic Inventory & deletion of KVM VMs
https://geni-orca.renci.org/trac/wiki/OMDeventhandlers
Using Check_MK to monitor the "DTC" hosting control panel
http://dtcsupport.gplhost.com/PmWiki/Nagios
Ignoring services based on advanced syntax with explanations:
http://deranfangvomende.wordpress.com/2011/08/31/check_mk-magic-dust-for-ignoring-stuff/
Chris Carmichael's notes and howtos.
http://sysadmin-101.blogspot.de/search/label/checkmk
Wednesday, December 19, 2012
Friday, November 16, 2012
Conditional variable assignment/ substitution
Bash does support the conditional variable assignment/ substitution
e.g. below code snippet
#! /bin/bash
name=${2:-"Juned"}
if [
"$name" != "Juned" ];then
echo "hello $name"
else
echo "bye"
fi
will define the variable name with second command line
parameter , but if there is no second command line parameter then the name is
defaulted to Juned
Thursday, November 8, 2012
How to increase semaphore value in linux
How to increase semaphore value in linux?
Semaphore can be described as counters used to control access to shared resources by multiple processes, They are most often used as a locking mechanism to prevent processes from accessing a particular resource while another process is performing operations on it.
Semaphore can be used when number of processes try to access the shared resource or same file,Semaphore stored in kernel, so that it can be accessed by all the processes,
# Semaphore can be identified unique id in linux kernel and it can be deleted using semdelete function,
# semaphore values can be incremented or decremented by using functions wait and signal,
If we are using ONFS (Oracle over network file system) in linux, we need to increase the kernel.sem value to improve system performance
Increasing semaphore value in linux
[root@server ~]# sysctl -A | grep kernel.sem
kernel.sem = 250 32000 32 128
[root@server ~]# ipcs -ls
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32semaphore max value = 32767
Increase semop value from 32 to 100, it can be increased upto 250 which is equal to semaphores per array,
Add the following line into /etc/sysctl.conf file,
vi /etc/sysctl.conf
kernel.sem = 250 32000 100 128
or
sysctl -w "kernel.sem = 250 32000 100 128"
or
sysctl -w "kernel.sem=4096 512000 1600 2048" [ Value reducing your CPU usage from avg 50% to 20%]
kernel.sem: max_sem_per_id max_sem_total max_ops_sem_call max_sem_ids
Now we have modified the kernel.sem value,
Please run the following command to update the changes,[root@server ~]# sysctl -p
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 1
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
kernel.sem = 250 32000 100 128net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
Run ipcs command to ensure the kernel.sem value
[root@server ~]# ipcs -ls
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100semaphore max value = 32767
Now system will be supported to handle numerous system call at the same time.
Reference
http://www.embeddedheaven.com/linux-semaphore-tutorial.htm
Subscribe to:
Posts (Atom)