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.

So if you’re getting:

tail -f /var/log/syslog
Jun 28 11:58:43 latitude13 kernel: [42125.406612] iwlagn 0000:0c:00.0: RF_KILL bit toggled to enable radio.
Jun 28 11:58:45 latitude13 kernel: [42127.020863] iwlagn 0000:0c:00.0: RF_KILL bit toggled to disable radio.

You’ll be pleased to know if you can see the card:

lspci -nnk
0c:00.0 Network controller [0280]: Intel Corporation WiFi Link 5100 [8086:4232]
Subsystem: Intel Corporation WiFi Link 5100 AGN [8086:1321]
Kernel driver in use: iwlagn
Kernel modules: iwlagn

You can check the rf status:

rfkill list
0: dell-wifi: Wireless LAN
Soft blocked: yes
Hard blocked: no
1: dell-bluetooth: Bluetooth
Soft blocked: yes
Hard blocked: no
2: dell-wwan: Wireless WAN
Soft blocked: yes
Hard blocked: no
3: phy0: Wireless LAN
Soft blocked: no
Hard blocked: yes

Then unblock the spanner:

sudo rfkill unblock 3

Start back up Wireless:

sudo ifconfig wlan0 up

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

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.

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

I will try to write more for xe vm-data-source-list and xe vm-data-source-query and update here.

Update 20101030:

New UserParamaters:

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.vmi[*],sudo /opt/xensource/bin/xe vm-data-source-query data-source=$1 uuid=$2

New Template_xen for importing with CPU and Memory Graph.

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

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.

wget http://download.opensuse.org/repositories/home:/ericgearhart:/zabbix/CentOS_CentOS-5/i386/zabbix-1.8.3-12.1.i386.rpm
wget http://download.opensuse.org/repositories/home:/ericgearhart:/zabbix/CentOS_CentOS-5/i386/zabbix-agent-1.8.3-12.1.i386.rpm
#installs fine
rpm -Uv zabbix-1.8.3-12.1.i386.rpm
#openssl-devel needed for zabbix_agentd
rpm -Uv zabbix-agent-1.8.3-12.1.i386.rpm
warning: zabbix-agent-1.8.3-12.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID a8022b27
error: Failed dependencies:
	openssl-devel >= 0.9.7d is needed by zabbix-agent-1.8.3-12.1.i386
#try and install openssl-devel
yum --enablerepo=base install openssl-devel
Loaded plugins: fastestmirror
Excluding Packages from CentOS-5 - Base
Finished
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package openssl-devel.i386 0:0.9.8e-12.el5_4.6 set to be updated
--> Processing Dependency: zlib-devel for package: openssl-devel
--> Processing Dependency: krb5-devel for package: openssl-devel
--> Running transaction check
---> Package krb5-devel.i386 0:1.6.1-36.el5_4.1 set to be updated
--> Processing Dependency: e2fsprogs-devel for package: krb5-devel
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel
--> Processing Dependency: libselinux-devel for package: krb5-devel
---> Package zlib-devel.i386 0:1.2.3-3 set to be updated
--> Running transaction check
---> Package e2fsprogs-devel.i386 0:1.39-23.el5 set to be updated
--> Processing Dependency: e2fsprogs-libs = 1.39-23.el5 for package: e2fsprogs-devel
---> Package keyutils-libs-devel.i386 0:1.2-1.el5 set to be updated
---> Package libselinux-devel.i386 0:1.33.4-5.5.el5 set to be updated
--> Processing Dependency: libsepol-devel >= 1.15.2-1 for package: libselinux-devel
--> Running transaction check
---> Package e2fsprogs-devel.i386 0:1.39-23.el5 set to be updated
--> Processing Dependency: e2fsprogs-libs = 1.39-23.el5 for package: e2fsprogs-devel
---> Package libsepol-devel.i386 0:1.15.2-3.el5 set to be updated
--> Processing Dependency: libsepol = 1.15.2-3.el5 for package: libsepol-devel
--> Running transaction check
---> Package e2fsprogs-devel.i386 0:1.39-23.el5 set to be updated
--> Processing Dependency: e2fsprogs-libs = 1.39-23.el5 for package: e2fsprogs-devel
---> Package libsepol.i386 0:1.15.2-3.el5 set to be updated
--> Finished Dependency Resolution
e2fsprogs-devel-1.39-23.el5.i386 from base has depsolving problems
  --> Missing Dependency: e2fsprogs-libs = 1.39-23.el5 is needed by package e2fsprogs-devel-1.39-23.el5.i386 (base)
Error: Missing Dependency: e2fsprogs-libs = 1.39-23.el5 is needed by package e2fsprogs-devel-1.39-23.el5.i386 (base)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.

So we need to work-around the custom e2fsprogs-devel in xenserver 5.6:

#enable the base repo for this run and install yum-utils
yum --enablerepo=base install yum-utils

#enable the base repo for this run and download new rpm for e2fsprogs-devel
yumdownloader --enablerepo=base e2fsprogs-devel

#install new e2fsprogs-devel
rpm --nodeps -Uvh e2fsprogs-devel*.rpm

#install openssl devel
yum --enablerepo=base install openssl-devel

You now have zabbix binaries on xenserver:

which zabbix_agent
/usr/sbin/zabbix_agent
which zabbix_agentd
/usr/sbin/zabbix_agentd

Check versions:

/usr/sbin/zabbix_agent -V
Zabbix Agent v1.8.3 (revision 13928) (16 August 2010)
Compilation time: Aug 21 2010 01:53:45
/usr/sbin/zabbix_agentd -V
Zabbix Agent (daemon) v1.8.3 (revision 13928) (16 August 2010)
Compilation time: Aug 21 2010 01:53:45
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).

Create a list of “filenames|size in bytes” of all httpd owned files sorted by reverse size:

find "/path/to/examine/" -user httpd -type f -printf '%p|%s\n' | sort -t \| +1 -2 > httpd.usage.txt

results:

/path/to/examine/some/user/files/file0.jpg|99995
/path/to/examine/some/user/files/file7.jpg|99994
/path/to/examine/some/user/files/file1.jpg|99993
/path/to/examine/some/user/files/file2.jpg|99991

Sum, average and count created file

awk -F\| '{ s += $2 } END { print "Sum: ", s,", Avg: ", s/NR, ", No.: ", NR }' httpd.usage.txt

results:

Sum:  10831638685 , Avg:  49539.2 , No.:  218648

Show top10 file counts by user:

cat httpd.usage.txt | awk -F\/ '{print$5}' | sort | uniq -c | sort -nrk 1,1 | head -n 10

results:

  61088 auser123
  35028 auser1435
  13907 auser124
   9952 auser1251
   9225 auser13516
   9181 auser1368
   8608 auser231
   7588 auser479
   6121 auser1338
   5844 auser666

Show bytes owned for a users files of specific user (from existing data):

cat httpd.usage.txt | grep USERNAME | awk -F\| '{print$2}' | awk '{  sum += $1 } END { print sum }'
2802473125

As your directory structures will probably differ from mine you must modify one or more of: +1, -2, $2 or $5

To-Do: Make size calculation automated from top10 list.

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.

There are three ways to try transfer inbound calls on the Gigaset C475 handset:

1) Doesn’t work for transfers to/from handsets on same basestation:

options >
external call >
extentension number >
send >
hangup

2) Doesn’t work for transfers to/from handsets on same basestation:

# key >
extension number >
conf >
hangup

3) Does work for transfers to/from handsets on same basestation only:

left menu button >
base station extension >
call >
conf / convereference >
hangup
Posted in geek, servers & tech | Leave a comment

Configure sendmail with saslauthd for SMTP AUTH

Install:

wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
rpm -Uv rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
yum install sendmail sendmail-cf cyrus-sasl-plain
cd /etc/mail
vi sendmail.mc
	change from: DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
	change to:   DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
	add:		 define(`confAUTH_MECHANISMS’, `LOGIN PLAIN’)dnl
	add:		 TRUST_AUTH_MECH(`LOGIN PLAIN')dnl
make sendmail.cf -C /etc/mail
chkconfig sendmail on
chkconfig saslauthd on
/etc/init.d/sendmail start
/etc/init.d/saslauthd start
adduser someusername (the username to allow relay)
passwd someusername (the username to allow relay)
vi /etc/passwd
	change from: someusername:x:500:500::/home/relay170:/sbin/nologin
	change to: someusername:x:500:500::/home/relay170:/home/relay



Telent SMTP AUTH test:

carl@carld630:~$ telnet smtp.hostname.com 25

Trying 123.123.123.123…
Connected to 123.123.123.123.
Escape character is ‘^]’.
220 smtp.hostname.com ESMTP Sendmail 8.13.8/8.13.8; Sat, 15 May 2010 21:01:58 GMT

AUTH LOGIN

334 VXNlcm5hbWU6

base64 encoded username

334 UGFzc3dvcmQ6

base64 encoded password

235 2.0.0 OK Authenticated

mail from: something@adomain.com

250 2.1.0 something@adomain.com… Sender ok

rcpt to: something@adomain.com

250 2.1.5 something@adomain.com… Recipient ok

data

354 Enter mail, end with “.” on a line by itself

Subject: Testing Relay with Auth
Some body
.

250 2.0.0 o4FL1wad003835 Message accepted for delivery

quit



Telnet Relay Denied Test:

telnet 89.248.50.170 25

Trying 123.123.123.123…
Connected to 123.123.123.123.
Escape character is ‘^]’.
220 smtp.hostname.com ESMTP Sendmail 8.13.8/8.13.8; Sat, 15 May 2010 21:03:25 GMT

mail from: something@adomain.com

250 2.1.0 something@adomain.com… Sender ok

rcpt to: something@adomain.com

550 5.7.1 something@adomain.com… Relaying denied. Proper authentication required.

quit
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.

A quick guide to getting openmanage installed for RAID monitoring on a Xen node.

OM 6.2 has an error with “Error: Missing Dependency: libxslt.so.1″ which is with the Dell package.

***Use 6.1 if 6.2 doesn’t work for you (R710 for example)***
***UPDATE~***: As pointed out by digibyte in the comments, you may be able to use 6.2 by installing:

wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/libxslt-1.1.17-2.el5_2.2.i386.rpm
rpm -Uvh libxslt-1.1.17-2.el5_2.2.i386.rpm

1. wget -q -O – http://linux.dell.com/repo/hardware/OMSA_6.1/bootstrap.cgi | bash
2. yum install srvadmin-storage.i386
3. srvadmin-services.sh start

Now test:
omreport storage pdisk controller=0

Sending an email on degraded RAID using omreport:

1. wget ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/8/Fedora/i386/os/Packages/mailx-8.1.1-46.fc7.i386.rpm
2. rpm -Uv mailx-8.1.1-46.fc7.i386.rpm
3. mkdir /root/scripts/
4. vi /root/scripts/check.raid.sh

#!/bin/sh
rm /tmp/check.raid.txt
omreport storage pdisk controller=0 | grep State | grep -v Online > /tmp/check.raid.txt
FILESIZE=$(stat -c%s "/tmp/check.raid.txt")
if [ $FILESIZE != 0 ];
then
	omreport storage pdisk controller=0 > /tmp/check.raid.txt
	cat /tmp/check.raid.txt | mail -s 'check RAID on XENxx' some@maildomain.ext
	echo "RAID - FAIL (mail sent)"
else
	echo "RAID - OK"
fi

5. chmod +x /root/scripts/check.raid.sh
6. crontab -e
*/5 * * * * /root/scripts/check.raid.sh >/dev/null 2>&1

7. Test /root/scripts/check.raid.sh

rpm -Uvh
Posted in geek, servers & tech | 4 Comments

Modifications to www.carlheaton.co.uk

I’ve been making a few modifications to *.carlheaton.co.uk like re-introducing the core Carl Heaton index page with a list of projects and other on-going ideas.

I will still post tutorials/dumps here where appropriate for code, server and electronics related things, but I’ll be posting no further ‘random links’ on this Slog because it’s too much of a pain to format and publish them vs. tweeting.

Posted in projects | Leave a comment

Converting 32bit RRD to 64bit RRD (moving cacti between architectures)

While migrating cacti over to a new virtual machine I got “ERROR: This RRD was created on another architecture” in /var/log/httpd/error_log when the crontab ran resulting in blank graphs. Read More »

Posted in code snippets, geek, servers & tech | 5 Comments