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!

Jan 20

Curl is a great little program that can be used to fetch content from webservers. It’s options are expansive, but at it’s most basic curl is used to fetch data from a web server. One of my most used features of curl is it’s ability to log output in a very granular manner, separating out how much time it took to get the dns resolution from the dns server, how long it took to connect to the server, how long to negotiate the http protocol, etc.  The curl manpage will show all the data that curl can display, but my favourites are Total transaction time, Time it took to get DNS resolution and the time it took to connect to the webserver. This pretty much tells me at a glance where the slow down might be with a single command.  The command I run looks like this

curl ‘http://www.cyborgworkshop.org’ -w ‘Total time: %{time_total}, Time in DNS: %{time_namelookup}, Time to Connect time: %{time_connect}\n’

And the output looks like this

Total time: 1.842, Time in DNS: 0.002, Time to Connect time: 0.016

Dec 4

If you have netcat and dd installed, you have a wicked fast way to clone a harddrive over the network.  You’ll need netcat and dd installed on both machines.   On the target machine (the machine you want to push the drive image to) run

nc -l -p 1337 | dd of=/dev/sda

and on the host machine (the machine you want to clone)

dd if=/dev/sda | nc 192.168.1.1 1337

This assumes that your IP is 192.168.1.1, so adjust accordingly.

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 Next Entries »