Naptan to GPX Waypoints (OSM)

If anyone has been following the goings on of OpenStreetMap of the uk you may have noticed the appearance of a load of Bus Stops (or duplicate bus stops if they where already in OSM). These have come from a database called NaPTAN kindly supplied to OSM by the UK Department for Transport and Traveline. See the OSM Wiki for more details.

These new points now need confirming/merging. I’ve also got a new GPS (BGT-31) which can alert me when I get near a waypoint – so I though why not load up the new data as waypoints into my GPS?

Heres the rough script I’ve written to download the data and convert it to the right format for my GPS. It also delete the name field, and changes the local_ref field to be the name, dropping the prefix 450. This is because the GPS only shows 6 characters for the name of a waypoint and in my area the last 6 characters are probably the easiest way to identify individual bus stops in 6 characters.

#!/bin/bash
wget http://www.informationfreeway.org/api/0.6/node[naptan:verified][bbox=-......] -O /tmp/naptan.osm
xmlstarlet ed -d "//tag[@k='name']" < naptan.osm | xmlstarlet ed -u "//tag[@k='local_ref']/@k" -v 'name' > naptan2.osm
sed 's/450//' < naptan2.osm > naptan.osm
gpsbabel -i osm -f naptan.osm -o ozi -F naptan.wpt

Just change the bbox to the area you want and it will generate the waypoint file which can then be uploaded to the GPS. It is a but rushed but it does the job.

September 27, 2009  Tags: , , ,   Posted in: OSM  Comments Closed

Zenoss, VMWare and Critical “is up” alerts

I’m currently working on setting up Zenoss to either replace or supplement our current network/server monitoring systems.

As its in test, it got stuck on our currently relatively unused “old” vmware environment (ESX 3). After initially going well it start to go wrong. We kept getting critical alerts that a server was up. Switching zenping to debug didn’t help either – it offered no new information and made the problem worse. As its open source I thought I’d take a look at the source, and hey presto I found the suspected problem. Stuck in an extra debug line, and confirmed it.

The problem – well it was an issue with the clock on the server caused by running under vmware , it was jumping about leading to negative rrt on pings. Funnily enough zenoss didn’t like. I’ll be submitting a bug so that it comes up with the slightly less cryptic error of Ip xxx.xxx.xxx.xx is up. To fix the problem, I had to specify the clocksource in the kernel options. See vmware KB 1006427 for details.

If you can’t fix this for some reason or can’t reboot server, for now you can put an event transform for status/ping in place to suppress them.

import re
 
match = re.search('ip (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?) is up', evt.message)
if match and evt.severity==5:
	evt._action = 'drop'

September 6, 2009  Tags: , , , ,   Posted in: Linux, VMWare, Zenoss  Comments Closed

WordPress: Stopping the Sidebar from Printing

I’ve already blogged about this, but here’s a new method on how to fix the problem. This one doesn’t bloat the site as much, and keeps the css files down to a minimum.

Please note: I’m assuming you still use the default theme. Things will be slightly different with other themes, but in general the same principal should apply.

In the file header.php remove media=”screen” from the following line:

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

In style.css, just before the line

/* Begin Typography &amp; Colors */

Add

@media screen {

At the bottom of the file add the following line:

}
@media print {
    /* style sheet for print goes here */  
   #sidebar { display: none; }
}

Bingo no wasted paper from printing the side bar.

August 14, 2009   Posted in: Howtos, WordPress  Comments Closed

Exim: Deliver some email address on local domain remotely

Most of my email is handled by a server I run, except for a few legacy address I can’t really move for now.  Before I had been lazy and send simply relayed all mail that didn’t have a local mailbox onto the second server.  However I was forwarding shed loads of emails to duff address.  To fix this I have entered a new router into exim and removed the other domain from the relay list.

special_remote:
  debug_print = "R: special_remote for $local_part@$domain"
  driver = dnslookup
  domains = pobice.com
  local_parts = lsearch;/etc/exim4/non_local
  transport = remote_smtp
  ignore_target_hosts = 127.0.0.0/8
  no_more

I then have entered the local_parts into a file.  Everything else then gets bounced, rather than been forwarded and bounced later on.

Word of warning – I’m no exim expert, but this seems to do the trick for me.

July 24, 2009   Posted in: Howtos, Linux  Comments Closed

Setting Up Blog Again

Any one who has been reading the Live Journal site will now I haven’t been well.  Because of that I couldn’t be bothered the fix blog.pobice.co.uk when it failed due to a Debian upgrade.

Well things have change, I’m slowly getting around to setting up my wordpress blog again, but on a better address.  I intend for this to be my home page as some point in the future too, as the old site isn’t really relevant to me today and is rather, well dead.

This means stuff doesn’t really work yet.  It’ll get fixed at some point soon I promise.

Update

Stuffs mostly fixed.  Thats enough work for now

June 14, 2009   Posted in: Uncategorized  Comments Closed

inputlirc

Just found a package for a bit of software in ubuntu called inputlirc.

Ubuntu lists it as:

Zeroconf LIRC daemon using input event devices
This is a small LIRC-compatible daemon that reads from /dev/input/eventX
devices and sends the received keycodes to connecting LIRC clients. Inputlircd
needs no configuration, it uses the standardised names for the keycodes as
used by the kernel. Many USB remote controls that present HID devices, as well
as multimedia keyboards should work out of the box.

Why is this good, well I just install this package and well I get full remote support – once I’ve configured the applications, which is still a pain in the arse. Now if the applications could be written to work with the zeroconfig lirc with well zero config the world will be great (well ok less un-great).

July 11, 2007   Posted in: Debian, Linux, Software, Thumbs Up, Ubuntu  Comments Closed

Yet Another Cacti Update

Well I’ve now got cacti pretty much sorted. Its finally running on a server with enough disk i/o to cope (it still > 3 years old, but at least it works). Its also now become important enough to be moved onto a server with support as some point. Once we’ve vitalised our File Servers, and maybe the odd DC and Citrix server.

Its now running on Debian for the next Cacti box (assuming it doesn’t have the gd bug).

What has helped with the new Cacti box is a combination of a few things – the new 1 min poller patch spreads I/O out better, and allows me to poll device which don’t do 64bit SNMP counters yet have gigabit ethernet ports every min, and leave everything else at 5 min. Improvements on plugins and a switch to cactid (a c version of the poller) has also really helped. The system now process ~400 hots in 35 seconds, dealing with ~4100 data sources and ~2200 rrd each min. Not bad.

There are a couple things that need improving however:
1) The threshold system now inspects data straight from the db before writing to the rrd files, which unfortunately causes the graphs in the email to be 1 cycle out of date (ie not show the data the emails about).
2) The Uptime+Threshold system host down email only works by patching files yourself at present when using cactid

As for ubuntu – either stop shipping cactid, or compile it again the correct version of the libraries. I’d much rather the package not be there than for it to not work, it gives people a bad impression.

May 21, 2007   Posted in: Linux, Software, Thumbs Up, Ubuntu  Comments Closed

HOWTO: NUT & CPU Throttling/Frequency Scaling

After a couple of power cuts lasting long enough for my UPS to shutdown my PC, I’ve been meaning to get NUTs to set my CPU to lowest speed possible when running on battery power, this week I finally got round to it. Please note these instructions are based on Debian 4.0 (Etch) and may require extra steps to work on different distro’s.

Read the rest of this post »

May 21, 2007   Posted in: Debian, Hardware, Howtos, Linux  Comments Closed

WordPress: Stopping the Sidebar from Printing

If there’s one thing that really winds me up on the net is that when printing web-pages you end up with a load of crap you didn’t want usually. For example with blogs you usually get a page or two with the content on the blog sidebar, which frankly I don’t need on a print out.

Well I’ve done something about it (well at least on my blog) – I’ve changed my theme so that on browsers that supports css and media types the sidebar shouldn’t print out. Here’s how you can add this to you’re WordPress blog

  1. Create a file print-style.css in the directory for you’re current theme with the following content
    .dontprint{ display: none; }
    div#menu{ display: none; }
  2. In wordpress, goto Presentation, Theme Editor and select the file Header
  3. Just bellow the line setting the css style sheet – should be something like this :
    &lt;style type="text/css" media="screen">
    @import url( %lt;?php bloginfo('stylesheet_url'); ?> );
    <style>

    add the lines
    &lt;style type="text/css" media="print">
    @import url(&lt;?php bloginfo('template_directory'); ?>/style-print.css);
    </style>
  4. Hopefully this should be enough, but if the theme author hasn’t used the div’s in the sidebar file you may have to add this line <div id="menu"> to the top of the file and this line </div> to the bottom of the file

May 9, 2007   Posted in: Howtos, Rants, WordPress  Comments Closed

PHP5 + Mostwanted

I’ve recently upgraded from PHP4 to PHP5 to allow me to test out a couple of web apps on the same machine that runs things blog. All in all it went well, had to specify timezone in a config file for some of the code I’ve done myself – and my TV recording system doesn’t do the full list of items to record (will fix at some point). It also borked the most wanted panel on this blog.

Anyway I have a fix for this now – simply call mostwanted using these two lines of php:
$mostwanted = new MostWanted;
$mostwanted->mostwanted(7, 30, true);

in replace of

MostWanted::mostwanted(7, 30, true);

December 9, 2006   Posted in: Software, bugs  Comments Closed