May 17

I have this perl script called Get_Temperature.pl that has been giving me fits. It simply reads a serial port that gets updated every second and does some regex on those values. The script was slowly consuming more and more CPU over time and creating a huge backlog of data. By the time it had run for an hour, it was at 60% CPU. To help troubleshoot, I wanted to output the amount of CPU that the script was using every time it processed a string, so I used this.

ps -o pcpu,pid,user,args -C Get_Temperature.pl

the -C flag allows me to specify the process name instead of a PID and the output looks like this

%CPU PID USER COMMAND
0.0 1075 jason /usr/bin/perl ./Get_Temperature.pl

Quick, low impact and works.

Apr 22

This is really a bad idea, but say you have a need like I recently had to setup an account so that you don’t need a password in order to log in. Most linux distributions make this pretty easy, just issue a passwd -d command on that user (as root) and the password prompt goes bye bye.

Apr 21

WMI is microsoft’s attempt at making SNMP “better”. Whether they succeed or fail at that is subjective, but querying wmi from a non windows hosts has been a problem in the past and has required lots of hoops and weird proxies. No more! wmic is a command line wmi client that you can install on linux. On a debian based host, just use

apt-get install wmi-client.

Once installed, a simple test like the following should get you lots of wmi goodies. Just remember that you need to use a valid windows account that has permissions to query wmi for this to work.

wmic -U $DOMAIN/$USER%$PASSWORD //$SERVER “Select * from Win32_Service”

$DOMAIN is your AD domain where your user exists
$USER is your username
$PASSWORD is your users password
$SERVER is the server name

A real world example

jason@workstation:~$ wmic -U AD/jason%ohnoes //server.cyborgworkshop.org “Select ProcessID,Started,State from Win32_Service where Name=\”Dhcp\”"

Note that I escaped (\) the quotes on DHCP. It’s important. Do it.

Outputs

CLASS: Win32_Service
Name|ProcessId|Started|State
Dhcp|1196|True|Running

Apr 21

I don’t usually write about specific products, but I have to drop a line about this new Atom 330 based board that I picked up from newegg. First off, it’s a dual core Atom CPU (with HT) that clocks in at 1.6ghz in 8 watts. Two SATA 2 ports and a single IDE attach the storage, 1 PCI slot, 1 DDR2 DIMM slot, onboard RTL gigabit LAN and Intel analog video with s-video out. Pretty much a 3 generation old PC. But here is the kicker, this little board runs EVERYTHING! Right now, I’m triple booting OSX (Kalyway with 0 tweaks, it just works) Mint Linux XFCE and VMWare ESXi (!). The ESXi did require me to smack in an intel based NIC, but the ICH7 chipset allows you to use the onboard sata storage as VMFS. The only real drag about this board is that it tops out at 2 gig of RAM, otherwise I would be ordering these things in bulk!

Nov 26

Fedora 10 has a lot of neat new features to play with, but the upgrade process isn’t as automatic as with Ubuntu. For people used to doing a dist-upgrade, follow these simple instructions and you will be able to upgrade your Fedora 9 box to Fedora 10 painlessly.

First make sure that your system is already patched and current. Depending on how far behind you are, this might require a reboot.

yum update

Now we need to cleanup any cruft that has accumulated in the yum cache, you can do that with

yum clean all

If you need to reboot at this point, I would do it.  A nice application exists in the repository called preupgrade. It gives you a very simple GUI that allows you to upgrade with just a few clicks. Install it with

yum install preupgrade

and then, as root, run it

preupgrade

You’ll be presented with a window that has a drop down box allowing you to select which version you would like to upgrade to.  Select Fedora 10, hit apply and wait for a few hours for the process to complete.  Your box should reboot when the ugprade is done and then you will be running Fedora 10!

« Previous Entries