Thursday, 31 March 2011

TRIM support for snow leopard on a Macbook Air 3.2 (2010)

http://www.groths.org/?p=308

And follow the erase free space option


After doing this and running xbench comparisons, i had a 17% increases in speed on my SSD! Sweet!

Works perfectly  on:
Model Name:    MacBook Air
  Model Identifier:    MacBookAir3,2
  Processor Name:    Intel Core 2 Duo
  Processor Speed:    1.86 GHz

Capacity:    121.33 GB (121,332,826,112 bytes)
  Model:    APPLE SSD TS128C                       
  Revision:    CJAA0201
  Serial Number:            xxx
  Native Command Queuing:    No
  Removable Media:    No
  Detachable Drive:    No
  BSD Name:    disk0
  Medium Type:    Solid State
  TRIM Support:    Yes
  Partition Map Type:    GPT (GUID Partition Table)
  S.M.A.R.T. status:    Verified


A more advanced check_mk check i've written for linux_ulimits


#!/bin/python


inventory_process = []
inventory_process_version = []
def inventory_linux_ulimit (checkname, info):
        inventory = []
        if checkname == "linux_ulimit":
                #print "linux ulimit inv"
                #print info
                for line in info:
                        ln1 = line[0]
                        ln2 = line[1]
                ln1 = int(ln1)
                ln2 = int(ln2)
                #print "%d %d" % (ln1, ln2)
                value = "%d / %d" % (ln1, ln2)
                inventory.append ( ("Ulimit", (ln1,ln2)))
                return inventory






#the actual check


def check_linux_ulimit (item, params, info):
        perfdata = []

        perfdata = (float((params[0])/float(params[1]))*100.0)
        #value = ("Cur=%d ; Max=%d" % (params[0], params[1]))
        value = [("ulimit_cur",params[0],params[1]),]
        #print value
        if perfdata > 90.0:
                return (2, "Critical@90%: %d of %d used. %.1f%%" % (params[0],params[1],perfdata), value)
        if perfdata > 85.0:
                return (1, "Warning@85: %d of %d used. %.1f%%" % (params[0], params[1],perfdata),value)


        return (0, "OK - %d of %d used. %.1f%% " % (params[0], params[1],perfdata), value)


# checking function, service description, perf data, invenotry function
check_info['linux_ulimit'] = (check_linux_ulimit, "Linux",1 ,inventory_linux_ulimit)


Tuesday, 29 March 2011

Zalman VE200 SATA caddy with virtual ODD


FFS trying to get this to work with a CF card is impossible.... No idea why it won't work....

Always comes up with a "1st Partition: 0", which means it doesn't recognise it

ERROR MESSAGES (using 57N firmware):
Error 23                 (I have no idea what this means but it displayed it even when a valid hard disk was connected that worked fine on a friends VE200!). Try CLEANing/wiping the drive! 
1st Partition: XX    where XX is a number such as 6, B, C, 83, F etc. (the number means 'the partition type of the 1st partition is XX and I DON'T LIKE IT!')
1st Partition: FF    Either 1st partition type is FF or I cannot read/understand the logical partition (volume) format (e.g. type 7 partition but it is formatted as exFAT)
1st Partition: 0      drive is not partitioned
NO - DISC             the VE200 has found the _ISO folder :-) but it contains no valid files with a valid extension (e.g. .iso, .ima, .dsk)
TOO Many FILES  you have more than 32 objects (files + folders) in the _ISO folder or in the user selected folder which is under the _ISO folder. (>32 FILES+FOLDERS! would have been a better message)
ALREADY HIT       you have already selected this file for emulation and it is already loaded
vDISK LIMIT         the VE200 can emulate a max of 4 virtual disks 
NO _ISO               I can read the 1st partition OK but I cannot find any folder called _ISO or _iso
First reset the VE200 back to DUAL MODE as follows: Unplug USB - Press and hold in Jog button - Reconnect USB cable. If this does not work, try:

1. Under Windows 7 run DISKPART, then type LIST DIS and then SEL DISK 2 (assuming disk 2 is your VE200 drive), then type LIST DISK and make SURE the * is against the VE200 drive and then type CLEAN to completely erase the hard disk partitions.
2. Unplug the VE200 and then wait for 20 seconds - then re-connect it whilst pressing in the jog wheel
3. Now partition and format the VE200 hard disk as NTFS PRIMARY.
4. Now use 'Safely Remove Hardware' systray icon to eject it and unplug and re-connect it whilst pressing in the jog wheel

With luck, it should power up and say "NO _ISO".

Monday, 28 March 2011

dual booting existing win 7 with win xp

ah yeah, that time again, you need to test your product on an XP install and well, there are none in the office.

easy peasy, just dual boot.

1. create a partition from win 7 by shrinking one of your current partitions. i think win XP only requires about 16-20GB.

2. insert win XP cd and restart machine to boot into it.

3. go thru w the install picking the right partition!

4. when finished and when you reboot win 7 will not appear in the bootloader and it will go into XP directly.
fine.

5. dl .net framework and install easyBCD. (.net is a requirement)

6. in easybcd, choose: add new entry > click on windows drop down list and choose NT/2K/XP/2K3 and make sure you leave Automatically detect correct drive ticked.

7. go to bootloader setup > make sure install vista/7 bootloader is selected and click on write MBR.

8. that is it. reboot and the bootloader should offer you a choice.

i guess some ppl will run into trouble with this process, sometimes win 7 wont boot anymore (startup repair w win 7 DVD will help), if you get an error loading OS after XP restart in the first phase of the process (before MBR is amended) then using the win 7 install DVD you can run the following commands:

  • bootrec /FixMbr
  • bootrec /FixBoot
  • bootrec /RebuildBcd
restart and you should be ok!

Thursday, 24 March 2011

Creating your own checks in check_mk


It is important to distinguish between inidividual checks and subset check e.g.

LINUX.SUBSET, where the main check is linux, subcheck SUBSET
e.g. linux.version is a subset of check linux, so there will be a check for linux + linux.version, which will both be contained in the same plugin script!


So, any further checks against linux, can be done via linux.XXX
Agent
/usr/lib/check_mk_agent/plugins#


linux_version.sh

#!/bin/sh
echo '<<<linux>>>'
cat /etc/issue.net


this will turn up if you telnet to the agent box i.e. 
telnet server 6556


Check the agent is outputting your plugin
check_mk -d servername | fgrep linux -A 5




The tricky part is the agent check itself.



Follow the guides on the check_mk site, then under the checks directory
/usr/share/check_mk/checks




#!/bin/python
inventory_process = []
inventory_process_version = []


# the inventory version (dummy)
def inventory_linux_version(checkname, info):
        # begin with empty inventory
        inventory = []
# fork to see which subcheck
        if checkname == "linux.version":
                # linux versions
#               print "linux version"
                for line in info:
                        ldistro = line[0]
                        ltype = line[1]
                        lcodename = line[2]
                        inventory.append ( ( None, (ldistro, ltype, lcodename) ) )
                        return inventory
        else:
                # must be std linux command
                inventory = []
                print "std linux check"
                #i
#the actual check
def check_linux_version (item, params, info):
        #print info.strip ('(')
        return (0, "OK - %s" % (info ,))
        #print item
        #print params
        #print info
        #       return (3, "Sorry - not implemented")


#check for std linux command
def check_linux (item, params, info):
        #print item
        #print params,
        #print info
        return (3, "Sorry - not implemented")

# checking function, service description, perf data, invenotry function
# one fucntion for each check (linux, linux.version)
check_info['linux'] = (check_linux, "Linux data (not finished(",0 ,inventory_linux_version)
check_info['linux.version'] = (check_linux_version, "Linux version",0 ,inventory_linux_version)




if it all works out it should have a 
check_mk -L | grep linux
check_mk --checks=linux.version -I servername


dump check info to console
check_mk -nv servername
SIMPLES!

Wednesday, 23 March 2011

Joyent smart machines and munin monitoring

ok it's time i gather what little info i have gathered on how to make this work.
Joyent uses Solaris, their own branded bastard perverted version (as if Solaris wasn't perverted enough!). it makes things difficult. very difficult.

so anyhow, to set up a munin server on joyent here are the instructions:

pkg_add munin-server

which will install the stuff.

then you must fix the munin user to something more "real" (Solaris love):

usermod -d /var/munin -s /usr/bin/bash munin
cp /home/admin/.profile /var/munin
chown munin:munin /var/munin/.profile
passwd munin (whatever, you will not actually log on w user munin)

then create a cron job to poll the nodes every 5 mins:
crontab -e munin
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /opt/local/bin/munin-cron


then as munin generates graphs and sticks them in /opt/local/www/munin/data, you must make this available via apache:


ServerName munin.yourdomain.com
DocumentRoot /opt/local/www/munin/data

AllowOverride All
Order allow,deny
Allow from all



obv you will wanna tighten this up in terms of security, like add .htpasswd permissions, symlink it or whatever.


this is pretty much it for the server.

note that any node will need to be added to the munin.conf file, and then a forced update will need to be run to reflect changes.
/opt/local/lib/munin/munin-update --force-root

(if you do that as it is running the cron job you will get a lock error/ dying)



now the nodes!

that is a little easier... just a little.

pkg_add munin-node

there again the munin user must be fixed as above, skip these steps if you are installing the node on the munin server machine.

to pre configure the plugins, this command should be run:

/opt/local/sbin/munin-node-configure --shell | sh

but beware, it doesn't always work. effectively it checks a plugin to see if it is working, and if so creates a link. the plugin itself is stored in /opt/local/lib/munin/plugins but you need to create a link in /opt/local/etc/munin/plugins to make it work.

also to get a nice easy way to restart the munin node, do:

svccfg import /opt/local/share/smf/manifest/munin-node.xm

svcadm enable munin
(or disable)

much easier than killing processes i find!

to test if everything is working ok on the client node side, do:

telnet localhost 4949
list
fetch

if you get a reasonable looking output, you're in!

Tuesday, 22 March 2011

Thecus 7700+ hot swap is go!

To go back on the Thecuses and their fabulous features, we have a Thecus 7700+ here at work and recently a hard drive failed because of a heat problem. (WD2002FYPS)
so guys and gals, the hot swap is absolutely go! took the faulty drive out without turning ANYTHING off, replaced it and it started rebuilding the RAID (5) straight away. 24 hours later the RAID is healthy again. moreover, the shares were still available during the rebuilding process.

i know this is supposed to be a feature according to the manual, but isn't it nice it's a feature that actually works as it should!
am always quite concerned about hot swapping and find it rather a rather nerve wrecking process!