Monday, 25 March 2013

Enabling Agent Forwarding on Mac OS X (and it's still not working)

Ok, so you've SSHd onto your favourite box, but when you try to connect to another linux server, it asks you for a password.
Huh? you say? It's ssupposed to use my private key!

First check if it's accessing the correct directory
#ssh server -l phil -v 
if the last few lines contain /root/.ssh/id_rsa or something similar

make sure those files exist

Also make sure in /etc/ssh_config
these lines exist

Host *
ForwardAgentYes

If this is still not working

on your mac run
#ssh-add

tada!


Thursday, 14 February 2013

Using Check_mk to check the Disk queue length on a windows server



Add this script to your plugins (name it as diskqueue.ps1 for example). Standard location is C:\Program Files (x86)\Check_mk\plugins

#this check returns both the disk read queue lentgh and the disk write queue length
#for all logical disks on a server in the format:
#<drive letter> <read queue length> <write queue length>

#write check name to host
Write-Host "<<<windisk_queue>>>"

#get all of the drive letters (DeviceID) of all local (DriveType 3) logical disks from wmi
$driveletters = Get-WmiObject win32_logicaldisk -Filter "DriveType='3'" | Select -ExpandProperty "DeviceID"

#get the current value for the disk read and disk write queue length and format to 2 decimal places
ForEach($driveletter In $driveletters){

$diskreadqueuelength = "{0:N2}" -f ((Get-Counter -Counter "\LogicalDisk($driveletter)\Avg. Disk Read Queue Length").countersamples | Select -ExpandProperty "CookedValue")
$diskwritequeuelength = "{0:N2}" -f ((Get-Counter -Counter "\LogicalDisk($driveletter)\Avg. Disk Write Queue Length").countersamples | Select -ExpandProperty "CookedValue")

Write-Host $driveletter $diskreadqueuelength $diskwritequeuelength

}


then add this to your /usr/share/check_mk/checks folder with the same name as the check windisk_queue

#!/bin/python

inventory_process = []
inventory_process_active = []

# the inventory version (dummy)

def inventory_windisk_queue(checkname, info):
    # begin with empty inventory
    inventory = []
    #   print checkname
    for line in info:
        drive = str(line[0])
        read = line[1]
        write = line[2]
        inventory.append ((  "%s" % drive, (read, write)  ))
        #inventory
    return inventory
 
#the actual check
def check_windisk_queue (item, params, info):
    #print item
    #print params
    print info[0][0]
    perfdata = params
    drive = str(info[0][0])
    read = info[0][1]
    write = info[0][2]

    performance =[ ( "Read", read), ("Write", write)]
    return ((0, "No checks implemented - ONLY FOR PERFORMANCE. Read %s, Write %s" % (read, write), performance ))


# checking function, service description, perf data, invenotry function
check_info['windisk_queue'] = (check_windisk_queue, "Disk Q Length",1 ,inventory_windisk_queue)

reinventory with cmk -uII
tada!

Thanks to JJ Clements for the powershell script

Friday, 28 December 2012

Setting up OpenVPN on ubuntu / Mac os x troubleshooting


There are several reasons why you could be getting
GET INST BY VIRT: [failed]
One of the reasons is that your config for CCD doesn't include a route for a subnet sitting behind your client link 1

Also you will have to check that ip_forwarding is turned on in your sysctl
sysctl -p
and make sure that masquerading is enabled via iptables
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
These should sort out your problems




Wednesday, 21 November 2012

Setting Hadoop replication




checking the replication factor on files:

hadoop fsck /user/analytics/staging_intellitxt/ -files -blocks

Setting the replication, where R = replication number

hadoop fs -setrep -R 2 /

This takes approx 5 minutes to complete and will give you a saving of about 30% in disk space!



Thursday, 1 November 2012

Nagios missing nagios.cmd

So that's missing and you can't run nagios or check_mk??

root@nagios:/var/log/nagios/rw# mknod nagios.cmd p
root@nagios:/var/log/nagios/rw# chown nagios:apache nagios.cmd
root@nagios:/var/log/nagios/rw# chmod 660 nagios.cmd
root@nagios:/var/log/nagios/rw# ls -la
total 8<br />
drwxrwxr-x 2 nagios apache 4096 Oct 30 13:37 .
drwxrwxr-x 5 nagios apache 4096 Oct 30 13:43 ..
prw-rw---- 1 nagios apache 0 Oct 30 13:37 nagios.cmd
root@nagios:/var/log/nagios/rw# /etc/init.d/nagios restart

How to restore a deleted file on git

Well let's see, you had a file in git, and one of the previous commits deleted this file.

You need this back.

Easiest way is to issue this command to list the commits and files affected.

git log --name-status

Once that's done - simply grep

git log --name-status |grep network.rb -A 5 -B 20

commit 98eaede206accb82d5fcb8ec07c1187344e60232
Author: Anthony
Date:   Tue May 15 16:52:26 2012 +0100

    Deprecate get_cluster_config
   
    Change-Id: Id3472f421c77a8ee18f78db8424333484636e813

D    modules/base/lib/facter/network/itxtcluster.rb
D    modules/base/lib/facter/network/itxtrank.rb
D    modules/base/lib/facter/network/network.rb
D    modules/itxt/files/bin/get_cluster_config
M    modules/itxt/manifests/files.pp
M    modules/itxt/templates/40tomcat-itxt.frag.erb
D    modules/pixelling/files/bin/get_cluster_config
M    modules/pixelling/manifests/init.pp

 



Then to restore the file.... find the last commit that affected that file:

 
git rev-list -n 1 HEAD -- <file_path>


check out that version before the commit

git checkout <deleting_commit>^ -- <file_path>

 
  


Sunday, 29 April 2012

Canon 5D mk ii compared to 5D mk iii

Canon 5D mk iii comparison with 5D mk ii 

I have been a long term Canon user, investing thousands in lenses, and as a non-manual reader, am sure some of these functions can be changed, but for the time being, I haven't figured it out! 
This is on the 1.1.2 firmware 

1. Custom profiles 

They don't save the image profile. e.g. in C1 mode, you tell it to save to RAW, and save to CF, then swap to SD when full. Register that as C1. 
change to C2 mode, tell it to save to L JPG, and save to CF and SD at the same time. Register that profile as C2 S
swap back to C1 mode and check your image settings.
It's still L JPG - strange huh?

2. Focusing whilst recording video.

on my 5d mk ii, i can press the AF button for it to focus. On the mk iii I can't - it's probably an option, but I haven't figure out where yet!








1.1.2 firmware