Sunday, 30 December 2012

ONMS.Net - Update on progress


I managed to do some work on The NOC at ONMS.Net with all the holidays in december. Above is an example of a graph showing the speed of a fan within the server hosting the application, imagine being able to track every minute or second of a specific device/object/event and keep that information for the future or take immediate action when something goes wrong... it amazes me to have the ability to monitor things so closely, pretty cool!

We need to be able to handle a maximum of 2.5 million updates per key though for every month, definitely time for some additional server power!

Saturday, 29 December 2012

NGINX fpm-php 504 Gateway Time-out

I recently encountered the 504 error on NGINX due to a php script fetching data from a slow database server, after 60 seconds of runtime the execution simply timed out... I tried all the suggested solutions I found on forums but they didn't seem to work, the solution that worked here:

Within nginx.conf under the location section and under the server section add the lines starting with fastcgi below:

server {
 location ~ .php$ {
  fastcgi_connect_timeout 60;
  fastcgi_send_timeout 180;
  fastcgi_read_timeout 300;

The timeout values above are all in seconds and may need some tweaking, also remember to check the max_execution_time setting in php.ini if not set within the script itself to extend the default php execution timeout. Remember to restart nginx to load the changes made to your nginx.conf

Thursday, 20 December 2012

Incredible - 6.28 years and rebooted 12 times

Our one server hosted with Hetzner is a recycled one purchased on the Hetzner market. It naturally runs Linux and uses two Samsung drives in a software RAID config. I was amazed to see a power cycle count of 12 on drives with a total runtime of 6.28 years so far, the statistics for both drives:

root@onms ~ # smartctl --all /dev/sda
smartctl 5.41 2011-06-09 r3365 [i686-linux-3.2.0-24-generic-pae] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     SAMSUNG SpinPoint P80 SD
Device Model:     SAMSUNG HD160JJ
Serial Number:    S08HJ10L455334
Firmware Version: ZM100-41
User Capacity:    160,041,885,696 bytes [160 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   7
ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 4a
Local Time is:    Wed Dec 19 23:12:39 2012 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x02)    Offline data collection activity
                    was completed without error.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0)    The previous self-test routine completed
                    without error or no self-test has ever
                    been run.
Total time to complete Offline
data collection:         ( 3677) seconds.
Offline data collection
capabilities:              (0x5b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003)    Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01)    Error logging supported.
                    General Purpose Logging supported.
Short self-test routine
recommended polling time:      (   1) minutes.
Extended self-test routine
recommended polling time:      (  61) minutes.
SCT capabilities:            (0x003f)    SCT Status supported.
                    SCT Error Recovery Control supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   100   100   051    Pre-fail  Always       -       6
  3 Spin_Up_Time            0x0007   100   100   025    Pre-fail  Always       -       5760
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       12
  5 Reallocated_Sector_Ct   0x0033   253   253   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   253   253   051    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0025   253   253   015    Pre-fail  Offline      -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       55101
 10 Spin_Retry_Count        0x0033   253   253   051    Pre-fail  Always       -       0
 11 Calibration_Retry_Count 0x0012   253   253   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       12
187 Reported_Uncorrect      0x0032   253   253   000    Old_age   Always       -       196608
190 Airflow_Temperature_Cel 0x0022   118   070   000    Old_age   Always       -       40
194 Temperature_Celsius     0x0022   118   070   000    Old_age   Always       -       40
195 Hardware_ECC_Recovered  0x001a   100   100   000    Old_age   Always       -       115166123
196 Reallocated_Event_Count 0x0032   253   253   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0012   253   253   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   253   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x000a   100   100   000    Old_age   Always       -       0
201 Soft_Read_Error_Rate    0x000a   100   100   000    Old_age   Always       -       0
202 Data_Address_Mark_Errs  0x0032   253   253   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%     49333         -
# 2  Extended offline    Completed without error       00%     49277         -

Note: selective self-test log revision number (0) not 1 implies that no selective self-test has ever been run
SMART Selective self-test log data structure revision number 0
Note: revision number not 1 implies that no selective self-test has ever been run
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

root@onms ~ # smartctl --all /dev/sdb
smartctl 5.41 2011-06-09 r3365 [i686-linux-3.2.0-24-generic-pae] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     SAMSUNG SpinPoint P80 SD
Device Model:     SAMSUNG HD160JJ
Serial Number:    S08HJ10L455779
Firmware Version: ZM100-41
User Capacity:    160,041,885,696 bytes [160 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   7
ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 4a
Local Time is:    Wed Dec 19 23:13:28 2012 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x02)    Offline data collection activity
                    was completed without error.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0)    The previous self-test routine completed
                    without error or no self-test has ever
                    been run.
Total time to complete Offline
data collection:         ( 3699) seconds.
Offline data collection
capabilities:              (0x5b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003)    Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01)    Error logging supported.
                    General Purpose Logging supported.
Short self-test routine
recommended polling time:      (   1) minutes.
Extended self-test routine
recommended polling time:      (  61) minutes.
SCT capabilities:            (0x003f)    SCT Status supported.
                    SCT Error Recovery Control supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   100   100   051    Pre-fail  Always       -       7
  3 Spin_Up_Time            0x0007   100   100   025    Pre-fail  Always       -       5632
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       12
  5 Reallocated_Sector_Ct   0x0033   253   253   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   253   253   051    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0025   253   253   015    Pre-fail  Offline      -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       55099
 10 Spin_Retry_Count        0x0033   253   253   051    Pre-fail  Always       -       0
 11 Calibration_Retry_Count 0x0012   253   253   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       12
187 Reported_Uncorrect      0x0032   253   253   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   130   076   000    Old_age   Always       -       36
194 Temperature_Celsius     0x0022   130   076   000    Old_age   Always       -       36
195 Hardware_ECC_Recovered  0x001a   100   100   000    Old_age   Always       -       109023062
196 Reallocated_Event_Count 0x0032   253   253   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0012   253   253   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   253   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x000a   100   100   000    Old_age   Always       -       0
201 Soft_Read_Error_Rate    0x000a   100   100   000    Old_age   Always       -       0
202 Data_Address_Mark_Errs  0x0032   253   253   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%     49331         -
# 2  Extended offline    Completed without error       00%     49276         -

Note: selective self-test log revision number (0) not 1 implies that no selective self-test has ever been run
SMART Selective self-test log data structure revision number 0
Note: revision number not 1 implies that no selective self-test has ever been run
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

root@onms ~ #

Tuesday, 4 December 2012

Intel SSD 520 series unboxing

I had the opportunity to help unbox an Intel SSD 520 series drive recently and being the the first SSD drive I physically encountered I was very excited to view it from every angle... In the years before SSD geeks quite quickly encountered new drive types in systems, servers, etc - SSD however seems to be coming in at a much slower pace, one reason I suspect is simply the cost of the drives being in my view to much!

 
 
The Intel SSD drives are still quite expensive and hard to source from large local suppliers, especially when looking for a specific model. Overall I was amazed at how much less the drive itself weighs, especially when compared to it's spindle driven brothers already in field. 

Intel has always been one of my favourite brands, the drive seems to be packed with Intel branded chips as can be seen in some online teardowns. The drive comes with an amazing 5 year warranty, which alone is simply awesome considering previous solid state drive longevity being well rubbish.


The SSD connects to your system using SATA and runs at 6Gb/s, this drive's performance does not disappoint, my uncle (the owner of this baby) has noticed a definite increase in performance. In addition Intel has also developed software allowing users of their SSD to monitor the drive's statistics in depth! I would love to get a busy database server running off of one of these drives to really give it a run for it's money!

The only con so far... Intel needs to do a better finishing job on the back of the drive, not that it matters beyond cosmetic but it does give a bit of a "why the hell did I pay so much and they couldn't take time to finish the back properly" feeling...


Tuesday, 20 November 2012

Cooler Master Storm Trooper

My uncle (in the picture to the left), recently purchased the Cooler Master Storm Trooper (http://www.coolermaster-usa.com/product.php?product_id=3054) enclosure while at a local gaming expo.

The Storm Trooper is by no means a small tower, it looks and feels mean (and ain't light either)! I was truly impressed with the engineering and thought that has gone into the design, from a special rubber handle to being able to change the orientation your drive bays...

With 8 fans built in and special factory made holes for water cooling, cooling in this tower should never become a problem.

The advanced dust filters in multiple locations also ensure your enclosure stays as dust free as possible.

The 9 bays for 5.25" drives provide able space for the majority or users/gamers. The 5.25" bays can also be converted into 3.5" and 2.5" drive bays.

The Storm Trooper supports Micro-ATX, ATX, and XL-ATX  motherboard sizes and also comes with 2 x USB 3.0 - overall the Storm Trooper is one of the best enclosures I've encountered to date. It reminds me of the large sturdy Intel server towers, built to last! 






Hey MIT mind giving back some IP addresses?

While playing around with RADB and whois on Linux, one of the addresses I randomly made up produced the result:

route:         18.0.0.0/8
descr:         Massachusetts Institute of Technology
               1 Amherst Street
               Cambridge
               MA 02139, USA
origin:        AS3
member-of:     RS-COMM_NSFNET
mnt-by:        MAINT-AS3
changed:       nsfnet-admin@merit.edu 19950118
source:        RADB

I've heard of many educational institutes having received huge IP allocations, with the majority of the IP addresses simply not being used... This seems to have happened quite often in the days long before IPv4 address exhaustion.

So now the question begs to be asked... if I need to provide reasons to service providers to obtain a small subnet of addresses, what reason could there be to continue allowing such huge allocations from even existing? The powers that be should challenge MIT to prove their complete usage of a /8 or lose the right to use the block, simply said the Internet needs the additional addresses...

Hackberry A10 in South Africa

Hackberry A10 in South Africa...

We ordered a HackBerry A10 from miniand.com a few days ago, I was amazed at how quickly and smoothly the delivery was done, especially when compared to the months of agony we've experienced with our yet to be delivered Raspberry Pi...

In the box you receive a power supply (5 volts, 1A), USA plug type (easily converted) a nice branded cloth bag and the board in proper protective packaging. 

The next step? Getting Debian installed and running, I'll upload a an image for all to download once I have one ready!

Tuesday, 13 November 2012

Pointers in C in a nutshell!


Pointers are used for dynamic memory allocation in C, the quick overview:

int number = 54; //Assigns variable called number the value 54

int *pointme = 52; //Creates a pointer variable named pointme and assigns it a value of 52

int *pointme = &number; //Points pointme variable to the address in memory of the variable number

printf("Pointer address %p has a value %d", pointme, *pointme); //Print out the address and value of the pointer

Coding Comment Funnies

The gems I've found in code:
  • goto fetch;//I hate goto, why the hell am I using it, sorry Sarah O'Conner...
  • From FNB banking site: //furk, this is such a crap way of setting the image path - any suggestions are welcome
  • From FNB banking site: //the money shot
  • From FNB banking site: //this method was bastardised on request from KS! I would never in good conscience code like this :D
If you find any funnies please send them to support@drakepeak.net

The gems found on the Internet in general:

Exception up = new Exception("Something is really wrong.");
throw up;  //ha ha
 
double penetration; // ouch
 
// I don't know why I need this, but it stops the people being upside-down
x = -x;  

// I am not responsible of this code.
// They made me write it, against my will.
 
/* IF DOLPHINS ARE SO SMART, HOW COME THEY LIVE IN IGLOOS? */
 
// hack for ie browser (assuming that ie is a browser)
 
.class {border:1px solid gold;} /* I pitty the fool */

/* HP-UX sucks wet farts from dead pigeons' asses */


/***************************************************************************/
/*  deep wizardry. do not touch.                                           */
/*                                                                         */
/*  no seriously.  XXXXXX I'm looking at you. If you screw with this again */
/*  I will kill you with my swingline stapler.                             */
/*                                                                         */
/* ...                                                                     */ 
 
// This is crap code but it's 3 a.m. and I need to get this working.

/*And now, getting all of that to look half decent in the retarded step brother of the browser family, Internet Fucking Explorer */

// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
 
..} else { // we are screwed
 /* fill in later */
}
 
//Mind boggling, gibberish version of a SQL statement, but it work's, so dont touch it 
 
/* F_ck me gently with a chainsaw... */ 
// Whoever put this here is an idiot...this doesn't work at all !
// Hardcoded this for time sake ... will make andrew fix later :)
 
 
 
 
 

 
 
  

Monday, 29 October 2012

Monitoring Data Centers in the path of Hurricane Sandy

Using The NOC (www.onms.net), I was able to monitor a bunch of data centers in the path of Hurricane Sandy, the results highlighted something I never really considered...

When the charts indicated the data center was unreachable from Sandy I would try and access them from my local machine as well as their status updates on twitter or status websites when available. Mostly when the charts indicated they were offline I could find a status update confirming this, however for example with NYI (www.nyi.net) which was online the entire time I have clear indication that they dropped off...

After a quick investigation using BGPlay (http://bgplay.routeviews.org/) it would seem that the various links between my monitoring system in Kansas and the data centers where offline due to Sandy or flapping and were clearing influencing my access to NYI although other routes to NYI stayed online all the way (clearly the reason for Netcrafts 100% uptime article about NYI). NYI definitely did an amazing job, my main point is from a pure monitoring perspective: 

1. Have more than one monitoring location if possible, especially as certain locations may give you an all clear and others indicate problems (not that NYI could do much about this in any case)

2. Keep in mind your BGP peers are uber important, similar to what happened during Hurricane Katrina a data center may remain online but your peers may fail, especially due to fuel shortages, in Katrina the one data center even delivered fuel to a peer to keep them online, perhaps something to consider in planning.

3. If your data center offers monitoring of your servers/services it should by no means be your only monitoring service, if an entire data center goes down chances are you won't be receiving any notifications.

Thursday, 25 October 2012

Afrihost moves to MTN


Afrihost (afrihost.co.za) recently announced a move to MTN (www.mtn.co.za) from IS (www.is.co.za) for all their ADSL users, on 16th October the planned move was executed... Everything however did not go as smoothly as they must have planned though and latency/speed complaints continue today (1st Nov). With hindsight at 20-20 below are a few things I picked up on from the move...

1. Good communication really helps with calming the crowd, Afrihost managed to do this in large part with social network messages and replies to most user comments. Many people have mentioned dropped calls and long support call queues which can easily happen when many subscribers have the same issue, of course if they can answer the call and put you in a queue they can offer an automated service to help manage the queue better, like offering a call back etc

2. If you promise to call someone, call them... many users complained of someone offering to call them back but then never calling, this just in turn angered their customers more...

3. Social sites play a huge role, although they didn't post much during the stormy days on their facebook page they seem to be mostly in control of Facebook and Twitter, the main problem being those complaints for which they don't have an immediate solution, in which case they can only try offer assurance of future plans although personally I think this should have been part of the original plan.

4. If you own multiple companies (Afrihost owns Axxess www.axxess.co.za), for the love of all that is good don't move both to a new network at the same time... Most users think these are two independent ISP's and are confused why both moved, additionally they have two companies worth of support calls in one, this was just a plain bad move unless unavoidable...

5. They announced carefully planning had gone into the move and all was covered, the day of the move many could not connect though... this was blamed on a lack of IP address pools on the Telkom (www.telkom.co.za) side of things. Telkom provides the ADSL lines in South Africa, Afrihost claim Telkom didn't implement their request correctly, who knows what really happened...

6. IS (www.is.co.za) have a Telkom connection for traffic from clients in Cape Town, after the move however all these clients ended up being redirected via the MTN in Johannesburg, adding latency to all those users, especially for their local Cape Town servers... Afrihost say they are now fast tracking a plan for Cape Town but it's to late for many users, additionally they claim this influences only certain users in Cape Town, which can obviously not be the case...

7. Latency increased for some paths and seems like it's going to stay, the graph at the top of the page shows monitoring I configured for work to my monitoring service at onms.net from Johannesburg, clearly certain links have remained the same but many have gone up in latency. Many users complained of unacceptable gaming latency, jumps of 60ms+

8. Youtube - users mentioned Youtube being slower and jitter like, I did some testing and it seems like MTN doesn't have a local cache server for Youtube like IS, Mweb, and other local ISP's provide, therefore all the traffic goes overseas and in turns makes Youtube slow. Not sure if they are working on a solution to this?

9. Many users, especially those using uncapped accounts, posted speed test results which show speeds at a fraction of their respective line capacity... I did a quick download test and the speed was on par with the line for local speeds, international seemed to be about half the line speed on average and unstable in both Johannesburg and Cape Town. The same download was running at full speed on my MWeb account.

10. Have a news server ready, with the move the old news server was no longer available, something easily overlooked but many users remain loyal to NNTP

11. They provided another ADSL realm on the previously used IS network to help with the moving pains called afrigamer.co.za, overall a nice gesture but many couldn't as they needed to change router settings and for us to gain access to clients mean't driving out, which is just not a viable option. Afrigamer seems to have moved over to MTN to as many users noted the same speeds/latency issues after the free use of the afrigamer.co.za realm expired.

Friday, 19 October 2012

Linux Mint 13 Cinnamon Upek fingerprint reader config

 I installed Linux Mint 13 Cinnamon on my ThinkPad T520 last night and was tempted to get the fingerprint scanner working... the whole process was almost completely painless and very cool!


USB device details:

147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor

Packages required:

sudo apt-get install fprint-demo libfprint-dev libfprint0 libpam-fprint aes2501-wy
sudo fprint_demo

fprint_demo is a GUI application to enroll different fingers etc for your system and worked a charm, there is a console alternative although I didn't give it a try called: pam_fprint_enroll

Next you need to edit: /etc/pam.d/common-auth

Add the following line:

auth sufficient pam_fprint.so

Note that if you add it say 3 times you can try logging in with your fingerprint 3 times before PAM moves onto asking you for a password. You can also change sufficient to required if you would like fingerprint + password auth.

Friday, 5 October 2012

Linux Time server using NMEA output from a GiSTEQ USB GPS Dongle

It's amazing how accurate the time on a GPS device actually is, with as little as 4 satellites your location can be triangulated and time obtained. The time comes from 4 caesium or rubidium atomic clocks on board each of those satellites, the atomic clocks are so accurate they lose no more than one second in millions of years.

You'll need to install ntpd and gpsd on your system, in Ubuntu:

sudo apt-get install ntp gpsd

For older versions of Ubuntu eg. 11.04, you may need to get a newer version of gpsd, in my case I experienced a silent failure as a result of an older gpsd version. If you cat /dev/ttyUSB0 (assuming thats your device) and don't get any output try:

Setting Serial Baud: sudo stty -F /dev/ttyUSB0 38400
or Initializing the device: sudo minicom --device /dev/ttyUSB0

Spare netbook I have running as a NTP server, indoors but still has a fix from 8 GPS satellites...

To configure the gpsd edit the /etc/default/gpsd file and change it to look like this:

# Default settings for gpsd...
START_DAEMON="true"
GPSD_OPTIONS="-b -n"
DEVICES="/dev/ttyUSB0"
USBAUTO="false"
GPSD_SOCKET="/var/run/gpsd.sock"

Then edit the file /etc/ntp.conf and change it to look something like this (just so you now, this file will allow remote systems to sync to your server):

driftfile /var/lib/ntp/ntp.drift

# Enable this if you want statistics to be logged.
statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Query the local GPSD daemon
server 127.127.28.0 minpoll 4 maxpoll 4 iburst
fudge 127.127.28.0 time1 0.420 refid GPS

server 127.127.28.1 minpoll 4 maxpoll 4 iburst prefer
fudge 127.127.28.1 refid PPS

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

You can go through the ntp.conf file and change it to your own setup, the above worked perfectly for me.

You can check your config on the time server by using: ntpq -p (sample output below)

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*SHM(0)          .GPS.            0 l   15   16  377    0.000   -2.578   5.689
 SHM(1)          .PPS.            0 l    -   16    0    0.000    0.000   0.000

You can query the time server remotely with ntpdate (see below), remove the -qv to set your local clock to the time server clock.

root@etienne-Lenovo:~# ntpdate -qv 192.168.1.177
 5 Oct 14:22:08 ntpdate[3569]: ntpdate 4.2.6p2@1.2194 Fri Sep  2 18:37:16 UTC 2011 (1)
 5 Oct 14:22:16 ntpdate[3569]: adjust time server 192.168.1.177 offset 0.005287 sec

Overall I'm extremely happy with the GiSTEQ USB GPS dongle, it's a reliable device and a perfect device for the $40 it cost me with shipping to South Africa. For my time server purposes and playing around it works perfectly - that being said - the time keeping club members are very strict! They usually speak of inaccurate in nanoseconds (ie. Linux won't cut it as it uses milliseconds, so they tend to use BSD) and would probably never consider a non Pulse Per Second (PPS) device for time keeping... ;-)

Thursday, 4 October 2012

GiSTEQ USB Dongle in Linux

I ordered a GiSTEQ USB dongle (SKU: C5-GR110-01) a while ago and it finally arrived today! I've been in the mood to play with NTP sync etc from a GPS dongle for a while and ordered one with the SkyTraq chipset instead of the commonly found SiRFstar III. This was mainly due to a reported problem resulting in the NMEA offset drifting and being unreliable...

The main aim being to geek out rather than anything serious as these dongles arn't built with timing as a primary purpose (there are more reliable Stratum 1 time servers available on the net for free...)

I of course immediately started playing around with getting the device working in Linux, the device appears as:


Bus 006 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

Status of the GPS:

Green LED continually on: Location not fixed yet, may take a while
Green LED flashing: Location has been fixed

If you cat /dev/ttyUSB0 and see characters than don't make any sense, ie. lines that don't start with $GP your baud rate might be a problem... You can adjust the baud rate in Linux to 38400 with the following command: stty -F /dev/ttyUSB0 38400

The lines you want to be seeing:

$GPGGA,143830.462,2547.2945,S,02815.8548,E,1,05,1.7,1441.4,M,17.8,M,,0000*74
$GPGSA,A,3,14,31,25,29,06,,,,,,,,2.7,1.7,2.1*3F
$GPRMC,143830.462,A,2547.2945,S,02815.8548,E,000.0,119.8,041012,,,A*78
$GPVTG,119.8,T,,M,000.0,N,000.0,K,A*0C
$GPGSA,A,3,14,31,22,25,29,06,,,,,,,2.6,1.8,1.9*3A

The above lines were the main ones I saw coming through, now to make sense of the important (well to me at least) ones... You can find a nice list of all the codes and analysis of each at: http://aprs.gids.nl/nmea/

$GPGGA,143830.462,2547.2945,S,02815.8548,E,1,05,1.7,1441.4,M,17.8,M,,0000*74:

GPGGA - GPS Location Fix Data
Time (UTC/Zulu): 143830.462 => 14:38:30 462 millisecomds
Latitude: 2547.2945
North/South of Latitude: S
Longitude: 02815.8548
East/West of Longitude: E
Fix Quality: 1 (0 - None, 1 - GPS Fix, 2 - DGPS Fix)
Number of Satellites in Use (not View): 05
Horizontal Dilution of Precision: 1.7
Altitude: 1441.4
Altitude Unit: M - meters
Geoidal separation: 17.8 (WGS-84 Earth ellipsoid - Average sea level)
Geoidal separation Unit: M - meters
Age of Differential GPS data (seconds): blank
Differential reference station ID: 0000
Checksum: *74

$GPVTG,119.8,T,99.1,M,000.0,N,000.0,K,A*0C

GPVTG - Track made good and ground speed
True Track degrees: 119.8
Relative to True North: T => True
Magnetic Track degrees: 99.1
Magnetic Track true: M
Speed over ground: 000.0
Speed in units: N => Knots
Speed over ground: 000.0
Speed in units: K => kilometers/hour
Checksum: A*0C


I'll blog about the Gisteq as a time source soon but in the meantime I wrote a quick BASH script to display the results in a loop:

#!/bin/bash
#
# Gisteq GPS USB Dongle
#

echo "Setting the baud rate to 38400..."
stty -F /dev/ttyUSB0 38400

while read input; do
 line_id=${input:1:5}
 if [ "$line_id" = "GPGGA" ]; then
  value_array=(`echo $input | tr "," "\n"`)
  gps_time=(${value_array[1]})
  gps_time=`echo $gps_time | awk '{for(i=1;i<=length($0)-4;i+=2){printf("%s:",substr($0,i,2))}}'|awk '{sub(/:$/,"")};1'`
  echo "UTC Time: $gps_time"
  latitude=(${value_array[2]})
  latitude_direction=(${value_array[3]})
  echo "Latitude: $latitude $latitude_direction"
  longitude=(${value_array[4]})
  longitude_direction=(${value_array[5]})
  echo "Longitude: $longitude $longitude_direction"
  gps_fix=(${value_array[6]})
  if [ $gps_fix -gt 0 ]; then
   gps_fix="Yes"
  else
   gps_fix="No"
  fi
  echo "GPS Fix: $gps_fix"
  satellites=(${value_array[7]})
  echo "Satellites in use: $satellites"
  altitude=(${value_array[9]})
  echo "Altitude: $altitude meters"
 elif [ "$line_id" = "GPVTG" ]; then
  value_array=(`echo $input | tr "," "\n"`)
  speed=(${value_array[6]})
  echo "Speed: $speed kph"
  echo "######################"
 fi
done < /dev/ttyUSB0

Thursday, 27 September 2012

Google Street View South Africa being followed?

While mapping out a route to one of our customers in Johannesburg, South Africa, I noticed the same vehicle appearing in almost all the images...

With certain areas in Johannesburg being straight out dodgy I'm assuming Google hired a security company to "covertly" follow the Google Street View car and keep it safe... Who knows?

Click here for a Street View in Johannesburg >>



Images © Google Inc.

Wednesday, 12 September 2012

Samsung G3 station inside and fix...

Being lazy never pays off for me yet I endulge in it regularly! This week I left our Samsung G3 station on the floor with the USB cable connected and someone/something bumped it enough to break off the connector inside the casing...

The clips are pretty hellish to open-up with plastic clips all round, a flat screwdriver from the side with the connectors worked for me!

The PCB can be cleaned around the where the connector was and soldered to the surrounding area. The connector itself has very small pins, with a bit of luck you can solder it back on and use a multimeter to test, I used hot glue to secure it for future wear and tear.

Tuesday, 28 August 2012

Nexus Q in a (little for now) more depth...

This post will continue to grow as I play around with the Nexus Q, so for the first while it might be like a minefield of thoughts but it may help someone else while I'm busy playing.... All the below are used at your own risk, if you turn the very nice Nexus Q into a paperweight don't blame me, the following worked on mine...

So far I only have Linux instructions, Windows users -> 1a. Install Linux

Rooting the Nexus Q and adding apps

1. Install the Nexus Q app on a tablet/phone supporting it, this may be an issue if your using a non-US account
2. Within the Nexus Q app setup your Nexus Q if you haven't done so yet, then select the device in the app home screen (mine is called "Living Room") and tap on Advanced, ensure you have USB debugging enabled (this also opens up port 4321, which telnet or nmap (eg. nmap -p 4321 192.168.1.185) can confirm for you
3. Download fastboot from: http://koushikdutta.blurryfox.com/G1/
4. Become root user and place fastboot executable in /bin/ for easy access, stay logged in as root, many commands below require you to have root access...
5. You will also need adb from the Android SDKs from http://developer.android.com/sdk/index.html (the adb application is in the platform-tools directory)
 5a. Make a symbolic link for adb to /bin/
6. Plug your Nexus Q into a USB port on your system and run:
 6a. adb start-server (from the platform tools directory in the Android SDK)
 6b. adb devices (should show your device: eg. List of devices attached AW1xxxxxxxx    device)
 6c. adb reboot bootloader (should turn the Nexus Q's lights red)
 6d. fastboot-linux-i386 devices (should show your device again, eg. AW1xxxxxxxx     fastboot)
 6e. fastboot-linux-i386 oem unlock (within 5 seconds run: fastboot-linux-i386 oem unlock_accept if you agree to the "world of hurt" message, hehe)
 6f. After fastboot finishes you should have the last two lines as (INFOdone and OKAY) and your Nexus should turn blue (If not I hope you don't have a nice new paperweight...)
 6g. Download the file: http://www.bliny.net/downloads/nexusq-boot.img (The image allows for ro.secure=0 ie. allowing remount)
 6h. Make some coffee, your nerves are probably a bit in need of some!
Nexus Q after reboot into bootloader

7. Open the Nexus Q app on your client device, you should have to re-setup it in the app, enable the USB debugging option again
 7a. adb reboot bootloader (once again your device's lights should all turn red)
 7b. fastboot-linux-i386 boot nexusq-boot.img (should show: downloading 'boot.img'... OKAY and then booting... OKAY, device lights should be blue again)
 7c. adb remount (should reply: remount succeeded)
8. Download http://oss.reflected.net/jenkins/6581/cm-9-20120819-NIGHTLY-n7000.zip
  8a. Unzip the file, it should have the folders and files in required below and step 9
  8b. adb push ./app/Superuser.apk /system/app
  8c. adb push ./xbin/su /system/xbin
  8d. adb shell chmod 06755 /system/xbin/su
9. Now you should be ready to install some apk's on the Nexus Q
 9a. adb push ./app/Browser.apk /system/app
 9b. adb install ./app/Trebuchet.apk
10. Start the app launcher up: adb shell "am start com.cyanogenmod.trebuchet/.Launcher" (if you have a bluetooth mouse/keyboard this should work, mine is coming in the post at present...)

About in Nexus Q

Keyboard and Mouse - Under dev... not working yet but in the meantime:

The Nexus Q has a Micro AB USB port which supports USB OTG (On-The-Go), if you plug it into your computer with a normal cable it will act like a normal peripheral, using a normal Micro USB cable to hub will result in the hub simply not working... You need to buy or make a USB OTG cable, this is exactly what you need to be able to use your mouse/keyboard on the Nexus Q. To make one (I made one because the shops were closed and I wanted to play ;-) ... you need some electronic skills though):

1. Carefully break/cut open the micro connector
2. Using a multimeter identify each pin, I opened my hub up and used the end point to identify each pin on the connector
3. Pin 4 of the 5 pins on the micro connector is the one you need to solder to pin 5 (GND pin)
4. Check all your pins for shorts, plug in and hope for the best!

The USB port in host mode seems to ignore USB devices, I'm working on this part too...



More commands that may be of interest:

Connecting to the Nexus Q via network: adb connect 192.168.1.185:4321
Reboot the device: adb reboot
Tail Android Logfile: adb logcat
Open Settings: adb shell am start -a android.settings.SETTINGS
Open Browser: adb shell am start -a android.intent.action.MAIN -n com.android.browser/.BrowserActivity
Open Google Play: adb shell am start -a android.intent.action.MAIN -n com.android.vending/.AssetBrowserActivity
Up: adb shell input keyevent 19
Down: adb shell input keyevent 20
Menu: adb shell input keyevent 1
Home: adb shell input keyevent 3
Back: adb shell input keyevent 4
Enter: adb shell input keyevent 23

More codes that can be used with adb shell input keyevent:

0 - KEYCODE_UNKNOWN
1 - KEYCODE_MENU
2 - KEYCODE_SOFT_RIGHT
3 - KEYCODE_HOME
4 - KEYCODE_BACK
5 - KEYCODE_CALL
6 - KEYCODE_ENDCALL
7 - KEYCODE_0
8 - KEYCODE_1
9 - KEYCODE_2
10 - KEYCODE_3
11 - KEYCODE_4
12 - KEYCODE_5
13 - KEYCODE_6
14 - KEYCODE_7
15 - KEYCODE_8
16 - KEYCODE_9
17 - KEYCODE_STAR
18 - KEYCODE_POUND
19 - KEYCODE_DPAD_UP
20 - KEYCODE_DPAD_DOWN
21 - KEYCODE_DPAD_LEFT
22 - KEYCODE_DPAD_RIGHT
23 - KEYCODE_DPAD_CENTER
24 - KEYCODE_VOLUME_UP
25 - KEYCODE_VOLUME_DOWN
26 - KEYCODE_POWER
27 - KEYCODE_CAMERA
28 - KEYCODE_CLEAR
29 - KEYCODE_A
30 - KEYCODE_B
31 - KEYCODE_C
32 - KEYCODE_D
33 - KEYCODE_E
34 - KEYCODE_F
35 - KEYCODE_G
36 - KEYCODE_H
37 - KEYCODE_I
38 - KEYCODE_J
39 - KEYCODE_K
40 - KEYCODE_L
41 - KEYCODE_M
42 - KEYCODE_N
43 - KEYCODE_O
44 - KEYCODE_P
45 - KEYCODE_Q
46 - KEYCODE_R
47 - KEYCODE_S
48 - KEYCODE_T
49 - KEYCODE_U
50 - KEYCODE_V
51 - KEYCODE_W
52 - KEYCODE_X
53 - KEYCODE_Y
54 - KEYCODE_Z
55 - KEYCODE_COMMA
56 - KEYCODE_PERIOD
57 - KEYCODE_ALT_LEFT
58 - KEYCODE_ALT_RIGHT
59 - KEYCODE_SHIFT_LEFT
60 - KEYCODE_SHIFT_RIGHT
61 - KEYCODE_TAB
62 - KEYCODE_SPACE
63 - KEYCODE_SYM
64 - KEYCODE_EXPLORER
65 - KEYCODE_ENVELOPE
66 - KEYCODE_ENTER
67 - KEYCODE_DEL
68 - KEYCODE_GRAVE
69 - KEYCODE_MINUS
70 - KEYCODE_EQUALS
71 - KEYCODE_LEFT_BRACKET
72 - KEYCODE_RIGHT_BRACKET
73 - KEYCODE_BACKSLASH
74 - KEYCODE_SEMICOLON
75 - KEYCODE_APOSTROPHE
76 - KEYCODE_SLASH
77 - KEYCODE_AT
78 - KEYCODE_NUM
79 - KEYCODE_HEADSETHOOK
80 - KEYCODE_FOCUS
81 - KEYCODE_PLUS
82 - KEYCODE_MENU
83 - KEYCODE_NOTIFICATION
84 - KEYCODE_SEARCH
85 - TAG_LAST_KEYCODE

Credits:

1. http://forum.xda-developers.com/showthread.php?p=28484300
2. http://forum.xda-developers.com/showthread.php?t=1209567


Linux CPU flag checking for 64bit and virtualization!

This might save you some time, the easiest way to determine if a system supports 64bit and virtualization in Linux is to look at the output of: cat /proc/cpuinfo

The line(s) your looking for like something like this:
flags    : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow rep_good nopl extd_apicid pni lahf_lm cmp_legacy

Depending on your hardware you may have many flag lines... the interesting flags which you need to look out for:

lm - 64bit support - (Long Mode - 64bit Extensions, AMD AMD64 or Intel EM64T)
vmx - Inter Virtualization - (Virtual Machine eXtensions)
svm - AMD Virtualization - (Secure Virtual Machine)

If the flags above appear you have support the the respective CPU feature. The easier way (but harder to remember) is to run:

64bit check: egrep -c ' lm ' /proc/cpuinfo
Virtualization check: egrep -c '( vmx | svm )' /proc/cpuinfo

The output above counts how many times the specified flag(s) appear, anything more than 0 indicates you have support.


Wednesday, 22 August 2012

Nexus Q in South Africa

I found a Nexus Q on a local auction site last week, after the initial shock passed of seeing one locally, I jumped into action and before long had a courier company at my door!

The local seller seems to have tested the device briefly as it's in a brand new condition and must have found out with a shock that it isn't supported in South Africa yet after paying thousands to import it....

I was however keen on getting it to work and getting it at a bargain price was all the more reason!

Before I could start playing I found myself at a nearby gadget store buying a micro HDMI to DVI converter (it comes with a branded micro HDMI to the usual larger HDMI plug - Type A - cable), a converter for the US plug the power supply (100 to 240 Volt) comes with and 4 banana plugs...

The feel of the device itself is amazing, it almost feels alien to hold it and it definitely has an unexpected weight to it!

I'm still however not to sure how well the volume control (the top half of the device can rotate a full 360 degrees while pushing it down mutes the sound) will survive general use and abuse, especially during a social event as mentioned in the intro video for the Nexus Q. Especially as everyone so far that finds the device between all the gadgets I have is immediately temped to pick it up by grasping the volume control part head-on...

The banana plugs were also a surprise as I haven't seen them much the last while. I only had stereo mini jacks and RCA connectors in my office (all my speakers are pretty much the same, not exactly an audiophile although I'm sure Vienna Acoustics speakers with banana plugs would have been great!). I'm pretty sure many users would have to go out and buy a cable to convert the banana's to something else...
Being a huge fan of Android (as you can see to the left, hehe) welcoming the Nexus Q to the family was a no-brainer!

Although the device has received many negative reviews (many with merit), the Nexus Q really has a nice design (if the volume control is solid...?) and has great hardware specs, especially for a media streamer...

The software side however really leaves one with this "what the heck is this" feeling, it's like watching a great movie only to find the budget ran out while they were working on the most important, to me in any case, end part!

I was expecting a proper Android device like layout with proper interface etc. boy was I in for a surprise!

When my uncle came close to the Nexus Q with his  Samsung Galaxy S3 it lit up and vibrated with joy, very cool indeed!

By not being in the US of course Google Play prevented the software from being installed on the first try, leaving the Q in it's welcome screen mode, effectively a paper weight!

Luckily getting past this problem involved a bit of crafty geek work after which setting up the Nexus Q was a breeze! Watching movies and music first uploaded to the cloud isn't much of a turn on for me, really sucks in fact as Google has assumed the world is well connected which always the case! Effectively leaving me with a YouTube streaming device with limited features, although I have a few plans to improve the device.

Cost wise - I would have been really upset if I paid the full price for this device... especially considering that I could whack my tablet or Android dongle into the same micro HDMI port and without effort connect the stereo mini jack for a great full featured multimedia experience without waiting for each item to stream and re-stream with each view...

Ideally the next step for me would be to get a proper working Android version on the device. Ultimately I would have appreciated a device from Google with a smartphone like Android on and additional apps for the media streaming parts. Hopefully once Google have improved the Nexus Q and start shipping it again the software on the device will give the power back to the user!

Google Nexus Q playing a YouTube video in South Africa


Monday, 20 August 2012

Network Engineering at Best?

Sooooo what do you do when your out in the field and realize that you've forgotten your belt in the rush to get working on a network job...?

I managed to get into the same pickle a few weeks back and being a network guy I figured what better than a makeshift belt from a piece of old Cat 5e cable... besides a bit of discomfort while pulling cables through a ceiling it did the job quite well!

Version 2.0 is below, only problem being you need to crimp a RJ45 when you lose weight and find a new piece of Cat 5e if you gain some!

I have however moved back to the trusty old belt but figured I'd share the experience!

Saturday, 18 August 2012

I found some really reliable fans!

I got the chance today to open up a server rack at a client that I've been eager to open for a good few years... I've always wanted to find out what brand of fan could survive a harsh environment 24/7 for the past 4+ years without failing...

The rack itself receives very little maintenance, lives in a busy school office with temperatures at times exceeding 35°C (95°F) and basically only gets looked at when a problem arises.
The rack itself is maintained by another company, a pity as I would love to get it in a better state!

So the best fans I have seen in a very long time and would highly recommend is from a company called FullTech (http://www.fulltech.com.tw/)

Ironically at the same time I was playing around I found a busted fan in one of my devices (the device is only about 2 years old) in the exact same rack... The fan in this case was so full of dust it simply stopped and was overheating, even trying to push the fan blades resulted in little if any movement...


Tuesday, 14 August 2012

Asus Zenbook Prime UX31A Unboxing!

My uncle recently purchase a brand new Asus Zenbook Prime UX31A on Amazon, saving more than $300 when compared to the best available local price. Asus have taken great care to ensure the box is properly padded for transportation and in this case luckily survived the 8600+ mile journey in the cargo hold of a commercial airline...

The Zenbook ships with a standard 19 volt power supply (which has the mini version of a Windows license sticker on it, I was temped to load Linux for my uncle but unfortunately he wasn't to keen on the idea...), a USB to ethernet converter, and convenient carry pouch.

Asus has really put effort into making the Zenbook look great - from the very nice metal finish of the body to illuminated keyboards. Additionally adding the pouch and USB to ethernet converter is great gesture on their part as I'm sure other companies would have excluded them as paid accessories...

While we received the Zenbook completely discharged we were up and running in no time (after finding the correct converter!)

The 1920 x 1080 resolution is definitely impressive! I was however at first concerned about white looking a bit to yellow for my liking... this however turned out to just be a gamma corrected profile which was enabled by default for the Intel graphics card and is easily toggled to a different profile.

We also compared the size difference between the Zenbook and Macbook Air (photo to the left and below). The Macbook Air remains a great device but the Zenbook managed to convince one of the most avid Apple fans I know to switch over to using the Zenbook instead....

Personally I still only own a normal i5 notebook as I'm not convinced that Ultrabooks are worth the it at their current retail price, although I'm sure they will become a future standard...
Macbook Air vs Asus Zenbook Prime
Asus Zenbook Prime on top of a Apple Macbook Air

Saturday, 4 August 2012

Linux "iostat" command...

I recently discovered the "iostat" command while debugging a slow database input/output problem... If you have a large amount of database reads/writes the iostat command can tell you how your disks are performing which in turn has a huge influence your a busy database...

You can install iostat on Ubuntu machines using:


sudo apt-get install sysstat


Command for a specific disk eg /dev/sda and updated every second:
iostat -dmx /dev/sda 1

Command for a quick once off overview of all disks:
iostat -dmx  (you can add space separated disks here too, eg. sda sdb)



The arguments used above:

-d (device utilization report)
-m (display in MB)
-x (extended statistics)



Sample output:


The %util column is the first one you'll want to keep an eye on as the server is actively being used. Basically it shows us how saturated the controller is for the specific device, if this percentage is constantly high the controller is working hard to keep up with the read/write requirements and could be a good indication that you maybe need to re-evaluate the server's hardware to accommodate the IO...

The other columns of the report as per the man page:


rrqm/s - The number of read requests merged per second that were queued to the device.
wrqm/s - The number of write requests merged per second that were queued to the device.
r/s - The number (after merges) of read requests completed per second for the device.
w/s - The number (after merges) of write requests completed per second for the device.
rsec/s (rkB/s, rMB/s) - The number of sectors (kilobytes, megabytes) read from the device per second.
wsec/s (wkB/s, wMB/s) - The number of sectors (kilobytes, megabytes) written to the device per second.
avgrq-sz - The average size (in sectors) of the requests that were issued to the device.
avgqu-sz - The average queue length of the requests that were issued to the device.
await - The average time (in milliseconds) for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the time  spent  servicing them.
r_await - The  average time (in milliseconds) for read requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.
w_await - The average time (in milliseconds) for write requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.
svctm - The  average service time (in milliseconds) for I/O requests that were issued to the device. Warning! Do not trust this field any more.  This field will be removed in a future sysstat version.
%util - Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%.


Thursday, 2 August 2012

MySQL to CSV quick one-liner

MySQL to CSV quick one-liner syntax example:

SELECT * INTO OUTFILE '/tmp/result1.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' FROM USERS WHERE USERNAME LIKE 'A%';

Raspberry Pi

I recently got my hands on a Raspberry Pi (Model B) and immediately started playing around with it...

First impressions - amazingly small device (exactly the size of a business card and slightly larger than an Arduino). The Pi has 256MB of RAM, 700MHz Broadcom BCM2835 ARM processor, and a GPU capable of 1Gpixel/s!

I was skeptical at first about getting my own but ordered my own shortly after playing around with this Raspberry Pi....

The composite port is also a very nice to have, overall the Raspberry Pi seems like a great option for embedded like scenarios (Kiosks come to mind), enthusiasts and would work a charm in school IT classes, perhaps helping to bring back some fun while learning how to program!

Software wise - Many Raspberry Pi (nice list here) ready images are available for download and can be copied over to the SD card using something like dd in Linux or Win32DiskImager in Windows, some even have a full on installer like the Fedora Remix.

I'm busy playing around with Android ICS on Pi with limited success. The memory available on the Pi (256MB) poses a problem as the memory requirements of Android ICS is 340MB (as per the documentation). Previous versions of Android have been reported to work but appear a bit sluggish... I'll continue the attempt and keep this blog updated!
My "Wish List" for the next model, even if at a slightly higher cost, or maybe they could have a high end line?
  • 256MB of memory is simply to little use the board effectively for all the projects I have in mind... if they could just increase it to double the size at least...
  • CPU is easily overpowered, especially with quad core ARM processors already available, a single 700MHz isn't enough
  • Wireless, ethernet port is a great to have but wireless without a dongle would be an awesome addition
  • Additional booting options, eg. booting from something like USB flash drives etc. without it being a mission!



Quick Debian/Ubuntu Wireless from Terminal


To connect to a wireless network from command line can be a bit of a challenge I encountered recently on a Raspberry Pi device... The easiest way to go about it without many more commands:

Become root user or use sudo before each command below:

1. iwconfig  (Look for the device with IEEE 802.11, usually wlan0 or eth1)
2. nano /etc/network/interfaces
 2a. Add the interface found is part of the auto line, mine looks like this:
       auto lo eth1
 2b. Add the following to the file below the other lines:
       iface eth1 inet dhcp  (change eth1 if your interface differs)
       wpa-ssid aironet.onms.net (the wireless network name)
       wpa-psk JellyBean (The WPA-PSK or WPA2-PSK passphrase)


The above assumes the wireless setup is similar to most I've configured/seen out in the field, if yours is not drop a comment and I'll help you out!

To start the connection run: ifup eth1 (or your interface name)
To stop the connection run: ifdown eth1 (or your interface name)


Hope the above helps someone!