bulk ptr/rdns check bash one liner

please note: does not return / breaks in the case of multiple PTR per IP (not very common but demonstrated in the example RANGE), just does the /24 class C, 1-254.

RANGE="195.99.147" ; COUNTER=1 ; while [ $COUNTER -lt 255 ]; do result=`dig -x $RANGE.$COUNTER +short`; if [ -n $result ] ; then echo $RANGE.$COUNTER $result ; fi; let COUNTER=COUNTER+1 ; done

Posted in code snippets, geek, servers & tech | Leave a comment

Zabbix Agent v2.0.5 on XenServer v6.0.0, v6.0.2 or v6.1.0

It would be nice if someone made a XenServer supplemental for zabbix, until then you need to re-install with every version upgrade…

ssh root@xenserver
# install zabbix user
adduser zabbix
# install the necessary
yum --enablerepo=base install openssl-devel gcc make --disablerepo=citrix -y
# download latest zabbix
mkdir /tmp/zabbix/
cd /tmp/zabbix/
wget "http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.0.5/zabbix-2.0.5.tar.gz/download"
tar xvfz zabbix-2.0.5.tar.gz
cd zabbix-2.0.5

# compile and build zabbix agent only
./configure --enable-agent
make install

# set for boot
cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_agentd
chkconfig zabbix_agentd on

# set config, see example contents below
vi /usr/local/etc/zabbix_agentd.conf

# allow zabbix in firewall
REJECT_RULE_NO=$(iptables -L RH-Firewall-1-INPUT --line-numbers | grep 'REJECT' | awk '{print $1}');/sbin/iptables -I RH-Firewall-1-INPUT $REJECT_RULE_NO -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
iptables-save > /etc/sysconfig/iptables
/etc/init.d/iptables restart

# start zabbix
/etc/init.d/zabbix_agentd start

# configure sudoers for xe and omreport access
vi /etc/sudoers
# remove:
# "Defaults    requiretty"
# add to end of file:
zabbix ALL = NOPASSWD: /opt/xensource/bin/xe
zabbix ALL = NOPASSWD: /opt/dell/srvadmin/sbin/omreport

# cleanup
rm -rf /tmp/zabbix/

Example zabbix_agentd.conf (single xenservers only, not pools):

SourceIP=xen-management-ip
Hostname=this-xenserver-name-in-zabbix
Server=zabbix-server-ip
LogFile=/tmp/zabbix_agentd.log
LogFileSize=1
DebugLevel=3
EnableRemoteCommands=1
LogRemoteCommands=1

UserParameter=xe.vmcountup,sudo /opt/xensource/bin/xe vm-list | grep running | wc -l
UserParameter=xe.vmcountdown,sudo /opt/xensource/bin/xe vm-list | grep halted | wc -l
UserParameter=xe.memory_total_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=memory_total_kib
UserParameter=xe.memory_free_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=memory_free_kib
UserParameter=xe.xapi_memory_usage_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=xapi_memory_usage_kib
UserParameter=xe.xapi_free_memory_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=xapi_free_memory_kib
UserParameter=xe.xapi_live_memory_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=xapi_live_memory_kib
UserParameter=xe.xapi_allocation_kib,sudo /opt/xensource/bin/xe host-data-source-query data-source=xapi_allocation_kib
UserParameter=xe.cpu3,sudo /opt/xensource/bin/xe host-data-source-query data-source=cpu3
UserParameter=xe.cpu2,sudo /opt/xensource/bin/xe host-data-source-query data-source=cpu2
UserParameter=xe.cpu1,sudo /opt/xensource/bin/xe host-data-source-query data-source=cpu1
UserParameter=xe.cpu0,sudo /opt/xensource/bin/xe host-data-source-query data-source=cpu0
UserParameter=xe.loadavg,sudo /opt/xensource/bin/xe host-data-source-query data-source=loadavg
UserParameter=xe.vbd_xvda_write[*],sudo /opt/xensource/bin/xe vm-data-source-query data-source=vbd_xvda_write uuid=$1
UserParameter=xe.vmi[*],sudo /opt/xensource/bin/xe vm-data-source-query data-source=$1 uuid=$2
UserParameter=hd.raid,sudo /opt/dell/srvadmin/bin/omreport storage vdisk | grep "Status                    : Ok" | wc -l
Posted in code snippets, geek, servers & tech | 2 Responses

Dell Ubuntu rfkill

Apparently the Fn-F7 option on the Lattitude 13 and other models causes breakage with Ubuntu 11.04 putting blocks on wireless. Read More »

Posted in code snippets, geek, servers & tech | 1 Response

Zabbix for XenServer (work in progress)

Using “xe host-data-source-list” and “xe host-data-source-query” I made some basic UserParameter for xenserver below. Read More »

Posted in code snippets, geek, servers & tech | 4 Responses

Zabbix Agent RPM on XenServer 5.6 Dom0

Grab Zabbix RPM for CentOS 5 from http://download.opensuse.org/repositories/home:/ericgearhart:/zabbix/CentOS_CentOS-5/ for your architecture. Read More »

Posted in code snippets, geek, servers & tech | Leave a comment

find and awk for httpd owned files (with count and average)

These are not very efficient (two sorts in one line for example) but for my needs work fine (improvements welcomed). Read More »

Posted in code snippets, geek, servers & tech | Leave a comment

Siemens Gigaset C475 handset <> handset transfer

There seems to be some problems transferring calls between Siemens Gigaset C467 handsets when on the same base station. It’s not a perfect fix but #3 does what we needed. Read More »

Posted in geek, servers & tech | Leave a comment

Configure sendmail with saslauthd for SMTP AUTH

Install: Read More »

Posted in code snippets, geek, servers & tech | Leave a comment

roundcube add subject to smtp_log

vi program/steps/mail/func.inc

change:

if ($CONFIG['smtp_log']) {
write_log('sendmail', sprintf("User %s [%s]; Message for %s; %s",
$RCMAIL->user->get_username(),
$_SERVER['REMOTE_ADDR'],
$mailto,
!empty($smtp_response) ? join('; ', $smtp_response) : ''));
}

to:

if ($CONFIG['smtp_log']) {
write_log('sendmail', sprintf("User %s [%s]; Message for %s; Subject: %s %s",
$RCMAIL->user->get_username(),
$_SERVER['REMOTE_ADDR'],
$mailto,
$headers['Subject'],
!empty($smtp_response) ? join('; ', $smtp_response) : ''));
}
Posted in code snippets | Leave a comment

Install Dell OpenManage 6.1 / omsa / omreport into Citrix XenServer dom0

UPDATE 17/06/2010: Please also see the comment from David below and blog post about Dells supplemental package for XenServer 5.6 which may be a better method. Read More »

Posted in geek, servers & tech | 5 Responses