<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Occasional Updates]]></title><description><![CDATA[Recipes and projects, mostly.]]></description><link>https://blog.ab5w.com/</link><image><url>http://blog.ab5w.com/favicon.png</url><title>Occasional Updates</title><link>https://blog.ab5w.com/</link></image><generator>Ghost 2.0</generator><lastBuildDate>Tue, 21 Apr 2026 11:13:14 GMT</lastBuildDate><atom:link href="https://blog.ab5w.com/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Shore power for the Polo]]></title><description><![CDATA[<p>Now that I don't drive anywhere really (I've put one tank of fuel in it this year) I  have an issue with the battery going flat. In the summer months I've been using a little <a href="https://www.amazon.co.uk/gp/product/B08K3BQTNK">solar trickle charger</a> which mostly works if there are enough sunny days, but it barely</p>]]></description><link>https://blog.ab5w.com/shorepower-for-the-polo/</link><guid isPermaLink="false">67464c744a7d540607e9a101</guid><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Tue, 26 Nov 2024 23:52:20 GMT</pubDate><content:encoded><![CDATA[<p>Now that I don't drive anywhere really (I've put one tank of fuel in it this year) I  have an issue with the battery going flat. In the summer months I've been using a little <a href="https://www.amazon.co.uk/gp/product/B08K3BQTNK">solar trickle charger</a> which mostly works if there are enough sunny days, but it barely does anything in the winter so I had to get a <a href="https://www.amazon.co.uk/gp/product/B09GTYRNHQ">jump pack</a>. The jump pack mostly works as well, but on the colder days even it can struggle to start the car due to it being an old mechanical diesel. I assume the battery is sapping the boost power, as opposed to it going straight to the starter. Once the car is running it will then start fine without help for the return journey, even after a short trip to the supermarket so I just need to keep the battery topped up to allow that. Running the battery charger/maintainer to the car is a bit of a hassle to do it regularly, as I have to then put the extension reel in the car, and then deal with connecting it up under the bonnet, or disconnecting it/putting it away when going anywhere. Especially in the winter when it's cold, dark, and rainy. <br><br>Enter <a href="https://www.rosenberger.com/product/magcode/"><em>MagCode</em></a><sup><a href="https://www.rosenberger.com/product/magcode/"><em>®</em></a></sup><em>  </em>which I learnt about from someone on the LandRover discord server who was using them for powering a lightbar, and after looking into the connectors a bit more I saw they are actually designed for hassle free trickle charging of vehicles. They are magnetic connectors so if you forget to disconnect it, it will harmlessly pull away from the car as you drive away. They are quite expensive though with the plug, socket, and cap coming to a smidge under £60 but I feel that's worth it for the ease of use it will provide. <br><br>Next up was working out where to install the socket on the car, I didn't particularly want to drill a hole in the wing, or the bumper. Mainly as the connector would stick out and might get caught on something or bumped. The polo has removable "fog light" (it doesn't have front fogs) trim pieces in the grill to allow access to the bumper fittings, so I decided to mount it on the nearside one, the one the same side as the battery. Annoyingly it has fins on it so like all good car projects, a piece had to be sacrificed for the greater good. The cut is a bit messy as I couldn't find my dremel, so had to use a combination of tin snips and the angle grinder with a 1mm disc.</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2024/11/IMG_20241126_202200940_AE.jpg" class="kg-image"></figure><p>Then I had to design a blanking panel for the grill piece and to mount the connector on. I took some basic measurements and mocked up a shape in <a href="https://www.tinkercad.com/">Tinkercad</a>, this was then 3d printed very thin in PLA so I could use it for refining the shape and hole locations against the grill.</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2024/11/IMG_20241125_211606201_AE.jpg" class="kg-image"></figure><p>This was drawn on with sharpie and then measurements taken and modifications made to the cad model. After several prototype prints to check the refinements I had the final design.</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2024/11/pologrillpanel.PNG" class="kg-image"></figure><p>This was printed in PETG filament so it's suitable for outdoor use, the panel is 3mm thick. I also printed a little tag for it which was crudely superglued in place.</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2024/11/IMG_20241126_202017599_AE.jpg" class="kg-image"></figure><p>I offered it up to the grill part and drilled out the 6mm mounting holes. Then it was bolted into place.</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2024/11/IMG_20241126_203607672_AE.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2024/11/IMG_20241126_203639778_AE.jpg" class="kg-image"></figure><p><br>Then it was just a case of fitting it onto the car. My trickle charger came with a loom that has ring terminals one end for connecting to the battery and a SAE connector at the other end. Luckily this was long enough that I was able to feed it down behind the bumper to where the trim clips in. To connect the SAE connectors together you annoyingly seem to need a middle piece else the polarity swaps over. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2024/11/IMG_20241126_204148971_HDR_AE.jpg" class="kg-image"></figure><p>With the trim clipped back in place and the plug connected to the socket</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2024/11/IMG_20241126_205851010_HDR_AE.jpg" class="kg-image"></figure><p>Showing how easily the connector comes away</p><figure class="kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/emskJfFWn1g?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen title="MagCode trickle charger connector"></iframe></figure><p>The lead goes to a secured point, so if I reverse away without disconnecting it'll just pull away like in the clip. The battery maintainer lives in a weatherproof box by the car currently and it isn't automatic so I still need to press a button to get it to charge/maintain, but connecting the car up and doing that is a lot easier than dealing with a normal extension reel and having to open the bonnet. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2024/11/IMG_20241126_205545247_HDR_AE.jpg" class="kg-image"></figure><p>Parts List:</p><p><a href="https://www.ebay.co.uk/itm/372591928903">Magcode Plug/Socket/Cap:</a> £58<br><a href="https://www.amazon.co.uk/gp/product/B09YCZK4DJ">SAE Leads</a>: £9<br><a href="https://www.amazon.co.uk/gp/product/B0989Z2BXZ">SAE Adapters</a>: £7<br><a href="https://www.amazon.co.uk/dp/B00B0X8CYC">Weatherproof box</a>: £10<br><a href="https://www.amazon.co.uk/AA-Battery-Charger-Maintainer-Batteries/dp/B00DW6RHN2">Battery Maintainer</a>: £30</p><p></p>]]></content:encoded></item><item><title><![CDATA[Adventures with the Telegram API]]></title><description><![CDATA[<p>I'm working on some home automation things with a Raspberry Pi and wanted it to be able to send me messages on telegram, as well as I ask for stuff and it gives it back to me. So this has lead to me spending a small amount of time playing</p>]]></description><link>https://blog.ab5w.com/adventures-with-the-telegram-api/</link><guid isPermaLink="false">6026da0c4a7d540607e9a08f</guid><category><![CDATA[projects]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Fri, 12 Feb 2021 22:25:23 GMT</pubDate><content:encoded><![CDATA[<p>I'm working on some home automation things with a Raspberry Pi and wanted it to be able to send me messages on telegram, as well as I ask for stuff and it gives it back to me. So this has lead to me spending a small amount of time playing with the telegram bot API, and it turns out it's actually pretty simple (at least for just sending messages) once figured out. I did find the main documentation a bit vague though in terms of a simple send messages script, and a lot of blog posts about setting up a bot use a framework which just does it all for you and offers too much in overhead/features for what I need. <br><br>So for a simple bot you just need to do the following;<br><br>Firstly message "<a href="https://core.telegram.org/bots#6-botfather">BotFather</a>" from your mobile telegram app (It doesn't seem to work well with the browser) . You then type /newbot and go through the prompts. The bot username has to end in bot, but the display name can be what you like. Once setup you will get a token, this comprises of the bot's id, and the auth token. In the format of bot$id:$token, for example bot1234:onDWzmiOTGB2V53qeUhXFxC1tHI0RS</p><p>Once the bot is created, you will be able to search for it and message it. </p><p>To get the messages you send to the bot, you can either poll the getUpdates endpoint or setup a web endpoint that telegram will POST some JSON to. This is the method I'm using but I will give an example of the updates API.</p><p>I'm using curl piped to jq for pretty printing of JSON on the command line. The format of the API URLs is;</p><pre><code>https://api.telegram.org/{bot_token}/{endpoint}
</code></pre>
<p>For the getUpdates endpoint;</p><pre><code>$ curl -s &quot;https://api.telegram.org/bot1234:onDWzmiOTGB2V53qeUhXFxC1tHI0RS/getUpdates&quot; | jq
{
  &quot;ok&quot;: true,
  &quot;result&quot;: [
    {
      &quot;update_id&quot;: 123,
      &quot;message&quot;: {
        &quot;message_id&quot;: 2,
        &quot;from&quot;: {
          &quot;id&quot;: 1234567,
          &quot;is_bot&quot;: false,
          &quot;first_name&quot;: &quot;Craig&quot;,
          &quot;username&quot;: &quot;exampleusr&quot;,
          &quot;language_code&quot;: &quot;en&quot;
        },
        &quot;chat&quot;: {
          &quot;id&quot;: 1234567,
          &quot;first_name&quot;: &quot;Craig&quot;,
          &quot;username&quot;: &quot;exampleusr&quot;,
          &quot;type&quot;: &quot;private&quot;
        },
        &quot;date&quot;: 1613134430,
        &quot;text&quot;: &quot;Boop&quot;
      }
    }
  ]
}`

</code></pre>
<p>As you can see it returns an array of the message. The chat id is important as you need that to send a message back to the chat, and message text is the content of the message you have sent. If you were only going to send messages to yourself from an application, you could use the sendMessage endpoint (example below) after you have found your chat id from the getUpdates endpoint. As I wanted to be able to request info as well as send messages I went with the webhook method.</p><p>To have Telegram send the messages to your webserver you need to set a webhook via the API. Your webserver requires a valid SSL certificate, and not self signed. So use Lets Encrypt. </p><pre><code>$ curl -s &quot;https://api.telegram.org/bot1234:onDWzmiOTGB2V53qeUhXFxC1tHI0RS/setWebhook?url=https://serverhostna.me/telegramexample/&quot; | jq
{
  &quot;ok&quot;: true,
  &quot;result&quot;: true,
  &quot;description&quot;: &quot;Webhook was set&quot;
}
</code></pre>
<p>You can then check your webhooks info with the API</p><pre><code>$ curl -s &quot;https://api.telegram.org/bot1234:onDWzmiOTGB2V53qeUhXFxC1tHI0RS/getWebhookInfo&quot; | jq
{
  &quot;ok&quot;: true,
  &quot;result&quot;: {
    &quot;url&quot;: &quot;https://serverhostna.me/telegramexample/&quot;,
    &quot;has_custom_certificate&quot;: false,
    &quot;pending_update_count&quot;: 0,
    &quot;max_connections&quot;: 40,
    &quot;ip_address&quot;: &quot;185.119.173.64&quot;
  }
}
</code></pre>
<p>Now when you send a message to your bot, some JSON will get posted to your URL. </p><p>To send a message you send to the sendMessage endpoint, using the chat id retrieved from the message update/webhook, and the text field for the message should be urlencoded.</p><pre><code>$ curl -s &quot;https://api.telegram.org/bot1234:onDWzmiOTGB2V53qeUhXFxC1tHI0RS/sendMessage?chat_id=1234567&amp;text=ping&quot; | jq
{
  &quot;ok&quot;: true,
  &quot;result&quot;: {
    &quot;message_id&quot;: 5,
    &quot;from&quot;: {
      &quot;id&quot;: 1234,
      &quot;is_bot&quot;: true,
      &quot;first_name&quot;: &quot;Example&quot;,
      &quot;username&quot;: &quot;examplebot&quot;
    },
    &quot;chat&quot;: {
      &quot;id&quot;: 1234567,
      &quot;first_name&quot;: &quot;Craig&quot;,
      &quot;username&quot;: &quot;exampleusr&quot;,
      &quot;type&quot;: &quot;private&quot;
    },
    &quot;date&quot;: 1613141321,
    &quot;text&quot;: &quot;ping&quot;
  }
}
</code></pre>
<p>An example of my php webhook on my server;</p><pre><code>&lt;?php

$telegram_auth = 'bot1234:onDWzmiOTGB2V53qeUhXFxC1tHI0RS';

$input = file_get_contents(&quot;php://input&quot;);
$input = json_decode($input,true);

if ($input) {
    $user_id = $input['message']['from']['id'];
    $chat_id = $input['message']['chat']['id'];
    $request = strtolower($input['message']['text']);
    if ($user_id != '1234567') {
        exit();
    }
    if ($request == 'temps') {
        $temps = json_decode(file_get_contents(&quot;https://serverhostna.me/?temps&quot;),true);
        foreach ($temps as $key =&gt; $value) {
            $output .= $key . ' =&gt; ' . $value . PHP_EOL;
        }
        $message = urlencode($output);
        file_get_contents(&quot;https://api.telegram.org/&quot;.$telegram_auth.&quot;/sendMessage?chat_id=&quot;.$chat_id.&quot;&amp;text=&quot;.$message);
    }
}
</code></pre>
<p>As you can see, I take the input and decode it into an array, which then can be processed. I've got a check for the requesting user, if it doesn't match my user id the script will exit. I also convert the incoming message to lowercase for easier matching, for when the mobile app capitalises the first letter of a word.</p><p>My first feature is to return the output of my temperature sensors. The message is urlencoded for the request to the API. </p><p>And it in action!</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2021/02/Screenshot_20210212-193839.png" class="kg-image"></figure>]]></content:encoded></item><item><title><![CDATA[So I did a dumb thing]]></title><description><![CDATA[<p>For the first time in my almost 32 years I had to visit A&amp;E, I was at my new house trying to undo a package that was secured with zip ties, with a knife. It slipped and as my hand was downrange I stabbed/impaled my left index</p>]]></description><link>https://blog.ab5w.com/so-i-did-a-dumb/</link><guid isPermaLink="false">5e912ab44ca63806841b9e1e</guid><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Sat, 11 Apr 2020 05:24:35 GMT</pubDate><content:encoded><![CDATA[<p>For the first time in my almost 32 years I had to visit A&amp;E, I was at my new house trying to undo a package that was secured with zip ties, with a knife. It slipped and as my hand was downrange I stabbed/impaled my left index finger with the knife. It didn't hurt at all at the time, I just remember seeing the blood and thinking "oh shit" and "that's a lot of blood", I walked fairly swiftly into the kitchen from the garage and stuck my finger under the tap to clean it. It was still bleeding a lot, so I wrapped it in a clean dishcloth I had and applied pressure. That's what I know from first aid courses I've been on. Apply pressure to stop the bleeding.  So not only had I sprayed water all over my new (to me) kitchen when investigating some piping under the kitchen sink, I have now dripped blood everywhere. As I was alone (I had gone there to pick some bits up before meeting my friend that was visiting town, then we were going to go visit our mutual friend for a curry night), I tried to call my dad. For the second time in my life that I've had to call my dad when I was in a bind he didn't pick up.. (the first time I got crashed into, in my first car). So he got 3 missed calls and about a 3 minute blank voicemail whilst I had to put the phone down to deal with the immediate bleeding issue. I tried ringing the home phone and that did get answered. Once I had communicated that I had to go to A&amp;E and he was on his way, I finally got to sit down (in a camping chair since no actual furniture yet..). At this point I actually got cold sweats, I imagine from shock, though I didn't feel too faint. I normally don't like blood at all, and it will make me feel faint. I had also downed about 2 cans of fanta as I just needed something cold. I think the having to deal with the bleeding issue had starved off the feeling faint etc. I was in the "oh shit I need to do something" zone and that lasted until I got to sit down and wait for help.<br><br>Once my dad turned up (about 20 minutes later), the first thing he did was go wipe up all the blood in the kitchen.. didn't ask how I was! Then it was into the car and onto A&amp;E. He dropped me in the road outside, so I had to walk in. First I was met with big signs about Covid, then when I talked to reception they asked me if I have have had a recent cough or a fever (not the best time to need healthcare..). Then they asked why I need care, then I was asked to sit down and wait. It wasn't that busy in the waiting area (it was a Sunday evening) and it wasn't long until I was called to the assessment room, so they could triage me. They asked what I had done, and when I said I had cut myself with a knife they asked if I'd cut anything off.. "I'm pretty sure it's all there" I said.  They said I had done a good job with my emergency dishcloth bandage to stop the bleeding. They also asked if I wanted it back, to which I declined. They bandaged my hand up and sent me back to reception to wait for someone to see me. Again it didn't take too long for my name to get called, and for me to go through the door to the actual A&amp;E side. Which is good as my hand was still leaking and the bandage was starting to turn pink. </p><p>The nurse guided me to a treatment bay and asked me to sit on the bed so she could clean the wound and have a look. She also commended me on my emergency dishcloth bandage for stopping the bleeding. She was like "Wow, you've certainly done a good number on this, it looks almost like a puncture wound" at this point I did start feeling faint and had to lie down. The wound didn't actually hurt that much until she started spraying saline solution into it to clean it up. She steristriped my finger back together and bandaged my hand up all neatly. When she was doing the assessment we did find out that there was some numbness on the side of my finger that pointed to nerve damage. So she phoned the hand specialists in Oxford. They wanted an X-Ray, so my nice bandage had to be cut off, and an X-Ray taken. Thankfully the X-Ray showed no damage to my bones. I was re-bandaged up, and then within 3 hours of stabbing myself I was discharged with a course of antibiotics to take for 7 days (3 of the biggest tablets I've ever had, per day), and an appointment at the hand specialists in Oxford the next day. I also missed curry with my friends. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2020/04/Snapchat-622568995.jpg" class="kg-image"></figure><p>The next day I was driven to Oxford by my dad for the appointment with the specialists. Again there was a bit of waiting around, before I my name was called. I sat in an armchair in a curtained enclosure whilst a nurse cut my bandage off, I could then see my damaged finger all steristiped together. Again I felt faint and had to have some water. The nurse also got my dad so he could come sit with me which was nice. After another period of waiting a consultant doctor came to inspect my finger. He made me move it lots and push and pull against his finger, which was fairly painful as it pulled against the cut that was starting to heal together. But whilst he was happy with my finger movement, he wasn't with the numb bit on my finger. It was nerve damage he said as had probably severed the tube the nerves are in, and that I would have to have surgery to fix it. If I didn't have surgery then there was a risk that the nerves would regrow in the wrong place and it would be very painful. So I signed the consent form, and they would call me the day before my surgery but couldn't tell me when it would be. Hopefully within a week. I also got a tetanus top-up jab.</p><p>That was Monday. On Tuesday I got a call that my operation was to be the next day and I had to be there at 8am. I also couldn't eat anything past midnight (I had a cheese and pickle sandwich around 7pm), or drink anything past 6am. Other than some water with my antibiotic tablet. Once there I checked in with the nurses, then it was some more waiting in reception. Then I was was taken through to the ward. They took my weight and gave me a robe and socks, but said I don't need to change into them until it was my time. Then it was more waiting. First the Anaesthesiologist came to see me to discuss what kind of anaesthesia I was to get. I said I don't particularly want to go to sleep with a general and he said a regional anaesthetic would be fine. Where he would just make my whole arm numb so I couldn't feel anything but I'd still be awake whilst they were operating. This was still much preferable to me than being knocked out. I've had a general before when they put a camera in my lungs as a child (at the same hospital actually) and all that I remember is being in a room with doctors etc before it, and then in a ward eating a cheese sandwich afterwards.. I don't really want to experience that again just because the whole going to sleep til it's done and not knowing weirds me out. After his visit there was more waiting, then the surgeons came around to discuss the surgery with me, and what they would be doing. They then marked my arm with a sharpie to point to what was being operated on. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2020/04/Snapchat-122212223.jpg" class="kg-image"></figure><p>So Left index finger, then a dot on the finger as well. Then it was back to waiting. A lot of waiting it turns out. They came around at about 10am, and I didn't get collected for surgery until 4pm. As I didn't sleep that well and I had to get up early to be there for 8am I spent most of the day napping. I was also very thirsty since I hadn't drunk any water since I had at my tablet around 6am.. <br><br>Eventually I heard my name being discussed and the nurse came to see me, then I had to change into my robe and some compression socks. Putting socks on one handed is very hard, especially so when they are compression socks.. Turns out the socks are only needed if you are having general, but as my consent form listen general as well as regional I needed them. I was then wheeled to theatre, or rather the pre surgery room where there either numb you up or put you to sleep. They did put a cannula into my hand and give me a sedative but I didn't feel too much different so I guess it just took the edge off. The Anaesthesiologist then whipped out the biggest needle I've ever seen (it must have been like a foot long) and started injecting my armpit (with the help of an assistant) with drugs to numb up my arm. He was using what looked like an ultrasound to see where my nerves were then was injecting the drugs near them. I didn't look too closely even though I still had my glasses on. I just stared at the ceiling. A couple of times he poked too close and it made my arm spasm. It wasn't too painful, just a very weird feeling. This took around 20 minutes and once it was done and my arm was suitably numb I was wheeled into the theatre.  <br><br>Once I was in, I had to shuffle myself onto the operating table. This is where it got a bit surreal for me. The Surgeons started to prepare for surgery, they covered my arm with a sheet and put it up against my face, which is fine since I was definitely not looking in that direction anyway. I was looking at the wall where there was a clock and a bunch of other medical stuff. I could also see the Anaesthesiologist who would be monitoring me, as well as the heart rate/blood oxygen meters etc. He did speak to me a fair bit to put me at ease, his assistant also talked to me about my hobbies and what food I liked to cook to take my mind of it. The surgery took about 40 minutes. I didn't feel any pain, I only felt some movement. The surreal bits where mostly when they were looking for my nerve tube to sew it back together "Where is it? I've found the bad boy!" and that they were just shooting the shit about life and what they were currently watching on Netflix to each other just like I would with my colleagues. Except they were poking around inside my finger instead of fixing some janky webserver issue. Once they had sewed my nerve tube back together and sewed my finger back up/bandaged it up a lot, I was wheeled to the recovery room. Here I finally got to have some water, as well as just relaxing and lying down whilst they took my vitals until I reached a stage where they where happy to wheel me back to the ward. </p><p><br>It was 2 hours between leaving the ward and returning, so I spent nearly an hour in the recovery ward being monitored. Though it didn't feel like that at all. My arm was very much still numb. The nurse also removed the cannula which was the most painful part of the whole ordeal as it took a bunch of hand hair with it.  I had been told that my arm would be numb for a while, I would be able to move it at the elbow around 9pm at night, but I wouldn't be able to move my fingers until around 10am. Getting dressed with a completely numb arm is interesting. Before I was allowed to leave the hospital I had to drink something, eat something, and go to to the toilet. I had a cup of tea, a cheese and pickle sandwich (clearly cheese sandwiches are linked to me having anaesthetic..) and a pee.  Turns out buttoning up jeans with one working hand is very hard. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2020/04/Snapchat-2025526565.jpg" class="kg-image"></figure><p>Having a fully numb arm from the shoulder down is weird. It's also very heavy and you have to move it around with your other hand. As described, around 9pm at night I could move my arm at my elbow, but when lying down I discovered that I could move my arm towards me but I couldn't move it back as it was too "heavy" but if I was sat up then gravity helped out. I woke up at 9:30am but still couldn't move my fingers. I slept a bit more and then about 11am I could wiggle them bit. In all it took about 30 hours for the numbness to completely wear off.</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2020/04/Snapchat-1622504315.jpg" class="kg-image"></figure><p>Then it was just more life with a hand in a bandage, like showering with a gallon ziplock bag over it. I did buy a cheap foam sling on Amazon and it made it more comfy for things like car journeys. It's very hard to do things one handed. Getting dressed is a chore, putting on socks especially so. I had to have my dad tie my shoelaces for me, and I bought my first pair of jogging trousers simply as they don't have buttons. I also had some interesting nerve developments, like when I brushed my arm against a hot radiator in the bathroom and it made my arm spasm like I had been shocked. </p><p> After 7 days I had another appointment to get the bandage removed. The nurse cut it off and I took one look at the damage and felt all faint and had to have some water and lie down again. I'm not good with injuries. Normally I would have had some hand therapy to help me heal from it, but due to the cononavirus issue I was given a leaflet, and told probably wouldn't be able to use my hand properly for a few weeks. It's now exactly a month from my surgery and my stitches have all dissolved/come out, I'm just left with a pretty gnarly scar. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2020/04/IMG_20200409_181206785_HDR.jpg" class="kg-image"></figure><p>I have about 80% movement in my finger compared to before the accident, but the side of it from the cut to the tip is still numb. It will take months for the feeling to come back completely, if it does at all. The nerves regrow at about 1mm per day. For a few weeks after the surgery I would get pins and needles feelings in my finger if I extended my arm too much, and if I poked the top of my palm below my finger, I could feel it in my finger tip.. but the weird nerve shit has mostly subsided now. </p><p>If I reach for something at an odd angle, or over exert my finger I get some weird sensations. I also can't yet use my finger like before, It's also very sensitive, which should reduce over time helped by inducing sensations onto it as per the leaflet I was given. Holding things is also interesting with the numb bit as you have lack of feedback. On the plus side we have been in lockdown so I've not needed to drive to do too much.. I can type with more than one hand now though which is handy for work! From what I've read online it can take from 6 to 8 weeks from surgery for it to be healed enough there is no pain, and can do stuff more normally. So that's 2 weeks to a month away for me. I'm very thankful for the great service the NHS provided, they fixed me up in no time from A&amp;E to the specialist to surgery, all within 4 days. I'm definitely more aware of what I'm doing now with sharp things, and my friends are too, as they don't want to "Craig" themselves. <br><br></p>]]></content:encoded></item><item><title><![CDATA[The sounds of the Series Land Rover/gearbox update.]]></title><description><![CDATA[<p>In place of a rebuild update, a couple of videos I have of series related things. I have completed the transfer box, part 3 of that rebuild coming soon hopefully but I've been lazy with the write ups. I've also started taking the main box apart so write up of</p>]]></description><link>https://blog.ab5w.com/the-sounds-of-the-la/</link><guid isPermaLink="false">5d962ff4d532dd290a1beee1</guid><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Thu, 03 Oct 2019 17:30:00 GMT</pubDate><content:encoded><![CDATA[<p>In place of a rebuild update, a couple of videos I have of series related things. I have completed the transfer box, part 3 of that rebuild coming soon hopefully but I've been lazy with the write ups. I've also started taking the main box apart so write up of that coming eventually also. </p><hr><p>A sneak peak into the inner workings of the mainbox.<br></p><figure class="kg-embed-card"><iframe width="480" height="270" src="https://www.youtube.com/embed/zkK4Vr5Lrbg?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure><p></p><p>I also took the series on a run recently.<br></p><figure class="kg-embed-card"><iframe width="480" height="270" src="https://www.youtube.com/embed/oNtAHJV9Z_w?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure>]]></content:encoded></item><item><title><![CDATA[Project Gearbox, part 2]]></title><description><![CDATA[<p>The gearbox rebuild finally continues! Though I have done some stuff since part 1. Mostly degrotting most of the parts removed and I also came to the conclusion that instead of finding an overdrive (because they go for silly money and would probably need a costly rebuild as well) I</p>]]></description><link>https://blog.ab5w.com/project-gearbox-part-2/</link><guid isPermaLink="false">5c7328b03eaf2555e8ba5748</guid><category><![CDATA[projects]]></category><category><![CDATA[rebuild]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Mon, 25 Feb 2019 02:39:47 GMT</pubDate><content:encoded><![CDATA[<p>The gearbox rebuild finally continues! Though I have done some stuff since part 1. Mostly degrotting most of the parts removed and I also came to the conclusion that instead of finding an overdrive (because they go for silly money and would probably need a costly rebuild as well) I would get a <a href="https://www.ashcroft-transmissions.co.uk/the-series-vehicle/high-ratio-transfer-case-kit.html">high ratio</a> transfer box kit from Ashcroft. This involves sending my transfer case off to be machined so it will accept the new gear set. I didn't want to just send mine off incase there were any issues so I did the sane normal thing and bought another transfer case from eBay. This one had the front/rear output shaft still in it that I had to remove to get it ready for shipping. So I got to disassemble that as a pre game for doing the complete transfer box. I just need to say, if you are going to do any gearbox/bearing stuff.. just get a press, you will thank yourself. Or at least have access to one. I got most of the aforementioned transfer case apart by hitting it with mallets, but then I ran into one bearing that would just not come off, no matter how much I hit it. So I bought a press. I did a whole bunch of research on what size to get and came to the conclusion that 20 ton was the best for a home mechanic and that I would want a floor standing one, as it provides more space for pressing and doesn't take up bench space which I'm lacking in. I just got one from <a href="https://www.ebay.co.uk/itm/282994398122">eBay</a>, nothing fancy but it does the job. It was £130, but so worth it, considering the rebuild kit for the gearbox is going to be more than that.. So anyway, onwards with the disassembly.  <br><br>The simple looking instructions. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_194331159_HDR.jpg" class="kg-image"></figure><p>Firstly the pinch bolt that holds the selector fork to the shaft for hi/low needs to be removed, I had to tap the spanner with the mallet to free it off before it came undone easily, after that I just had to remove all the nuts holding the housing to the case. They are all whitworth, like everything on the gearbox so far. I should also say, get a set of whitworth <a href="https://www.amazon.co.uk/gp/product/B0015NNOX6/">spanners</a> and <a href="https://www.amazon.co.uk/gp/product/B0039UHCG8/">sockets</a>. As it's all you will use.<br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_195120054_HDR-1.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_194350719_HDR.jpg" class="kg-image"></figure><p>Once they are all removed (in my case most of the studs came out as well), the housing is just gently prised away from the transfer casing<br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_200016773_HDR.jpg" class="kg-image"></figure><p>You can then pull it completely apart, and remove the dog gear for 2wd/4wd selection.<br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_200957557_HDR-1.jpg" class="kg-image"></figure><p>The next step is to remove the ring from the end of the selector shaft that the red levers ball sits in. Though I found that this was on there tight.. so I had to put the casing back together slightly so I could get enough leverage to get it to loosen off. Next time I will make sure I loosen it off whilst the whole thing is still together..  <br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_203723214_HDR.jpg" class="kg-image"></figure><p>Once the nut is removed the ring bit just pulls off, you can then remove the cover for the selector rods. The rusty gunk in here takes me back to school and the smell of the trombone I had to learn to play.. I also removed the pivot arm for the 4wd locking pin, it's held in with one bolt.<br><br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_204525469_HDR-1.jpg" class="kg-image"></figure><p>The ends of the selector shafts are bit rusty. I believe this is a common issue where they rust up due to lack of use and then either get stuck or cause issues trying to change between high/low. I think this is the issue my own box has as sometimes it won't go back into high very well. <br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_204532319_HDR.jpg" class="kg-image"></figure><p>They will now mostly pull out of the housing, I did have to tap the end of the threaded one with the mallet slightly to get it to shift. Here they are in all their glory, along with the dog gear for 4wd. After playing with them on the bench I think I get how they work (though I could be wrong..). <br><br>When the red lever is forward, the dog is pushed rearward and is disengaged from the teeth on the front shaft (so it's in high range, 2wd). If you press down on the 4wd yellow lever, it pivots allowing the locking pin to come out of the shaft which then moves backwards under tension from the springs, this causes the dog gear to go backwards locking the shafts together. Then when the red lever is moved to low range, if 4wd isn't already engaged it would engage the dog, else it just moves the low range gear into selection in the transfer case. Then when the red lever is returned to the high range location, to moves the low range gear out of selection and locks it against the high gear (to hold high gear to the shaft, as otherwise it can spin freely), and it moves the dog gear forwards to disengage 4wd. As the locking pin is under tension of the spring on it's shaft, when the hole slides under the pin it allows it to drop into it. The two output shafts can spin independently when not locked together due to a bushing in the end of the front housing shaft that the transfer cases output shaft slots into. It all makes more sense when it's in front of you. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_205818291_HDR.jpg" class="kg-image"></figure><p>Next up is removing the front drive shaft from the housing, this is pretty easy and just requires removing the castle nut from the end of the shaft (I pre loosened this when it was all together), the front drive flange will then slide off and the shaft can be pulled out. The oil seal retainer can also be unbolted to reveal the bearing. <br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_211128019_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_211245795_HDR.jpg" class="kg-image"></figure><p>Then I needed to remove the remaining studs from the front of the housing so that it could sit flat for the bearing being pressed out. This was pretty easy with the double nut method. You just need to screw one nut on as far as it will go, then tighten it up slightly, then thread another nut on until it butts up against the lower one. Tighten it up slightly, at the point you should see the stud move. Then undo the stud using a spanner on the bottom nut.</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_214058152_HDR.jpg" class="kg-image"></figure><p>To remove the nuts from the stud, I put it in a vice and then undo them with a spanner. The vice has aluminum sheet in front of the jaws to protect the threads. <br><br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_214346045_HDR.jpg" class="kg-image"></figure><p>The last bit to remove is the speedo housing, this is also fairly simple and just requires removing the nuts and studs like above. I did have a couple that wouldn't budge with the spanner and required using the breaker bar. <br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_221230150_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_221631386_HDR.jpg" class="kg-image"></figure><p>With the housing removed, you just need to slide the worm gear off the shaft and also remove the shims that are used to set the preload for the gears. <br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_222234982_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_222240667_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190223_222619612_HDR.jpg" class="kg-image"></figure><p>The last part of the disassembly (that wasn't the main casing) was to press out the seals and bearing. When I bought the press I also bought a set of <a href="https://www.ebay.co.uk/itm/401634939016">pressing disks</a>, they vary in size from about 18mm up to 70 something, they worked great for spreading the load of the press to the thing to be pushed out.<br><br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_170038757.jpg" class="kg-image"></figure><p>First up was the front output oil seal.<br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_165139422.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_165235408_HDR.jpg" class="kg-image"></figure><p>Then the rear output oil seal from the speedo housing. I had to use pressing disks in decreasing size to raise the height to where the press would reach it, worked well though. <br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_165815376_HDR-1.jpg" class="kg-image"></figure><p>Lastly was the bearing for the front output shaft. I used a pressing disk and an extension from my socket set for the press to push on to reach it.</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_170558_535.jpg" class="kg-image"></figure><p>The bearing on it's way out<br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_170654593_HDR.jpg" class="kg-image"></figure><p>Bearing freedom! It does feel pretty gritty when you turn it by hand, so probably good it's being changed. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_172013234_HDR.jpg" class="kg-image"></figure><p>Onwards to the main casing, firstly remove the massive circlip that retains the front bearing. This is where buying <a href="https://www.amazon.co.uk/gp/product/B01MQ26WDG/">massive circlip pliers</a> comes in handy.<br><br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_181329781_HDR-1.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_181334848_HDR-1.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_181547881_HDR.jpg" class="kg-image"></figure><p>The book then says to drive the shaft towards the rear until the bearing race is pushed out, I did try with the mallet but after a few hits it wouldn't budge so I took it up the the press in the shed. Pushed it out really easily. <br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_182012577_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_184819766.jpg" class="kg-image"></figure><p>Once the bearing race has fallen out, the case was then flipped over and the shaft pushed as far as it would go the other way. Until the gear butts up against the case. <br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_185323564.jpg" class="kg-image"></figure><p>Then it was back to the garage to prepare to remove the final bearing race. The book says to use a packing piece between the roller bearing and the race. They suggest using an old bearing race cut to size, which isn't useful if you are doing it for the first time. What I've found works (from doing the previous case) is to split the bearing away from the shaft. To do this place a chisel between the bearing inner race and the thrust washer and gently tap with a mallet, this will allow you to then pry the bearing away from the washer.<br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_191136974.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_191154499.jpg" class="kg-image"></figure><p>You can then fit a M10 nut in between the race and the washer. I found it works ok with one, but two would be best if you manage to get them to not fall out. Push the inner race up against the outer and tap the rear shaft with a mallet to wedge the nut tightly between the pieces. Then press the race out. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_191355651_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_191523491_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_192647863.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_193351448_HDR.jpg" class="kg-image"></figure><p>With the race removed the inner race can be pried off the shaft and then the next challenger is revealed. The circlip that holds the thrust washer in place. Safety squints engaged. You might be lucky and it has both eyes and can be easily removed. I have been unlucky on both occasions. On the first casing both eyes were missing and it took lots of trying to lever it up and away, and it snapping back in place before I was able to finally get it off. This time one eye was missing, so I was able to lever the bit with the eye out of the grove with <a href="https://www.amazon.co.uk/gp/product/B00BPSDCKG/">smaller</a> circlip pliers and then the rest of it using a couple of flat head screwdrivers, it only snapped back in place twice. <br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_193538320_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_195242498.jpg" class="kg-image"></figure><p>With the circlip removed, the thrust washer can be removed and then the shaft can be removed rearwards through the gears. <br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_195705791_HDR.jpg" class="kg-image"></figure><p>The last thing to do is to press the rear inner bearing race off the shaft, this is what caused me to buy the press originally. The low gear is used as a block to push the bearing off. You have to hold the shaft as you press, to catch it when the bearing comes off, else it will just drop. It's heavier than you are expecting at the time.<br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_195951614.jpg" class="kg-image"></figure><p>The complete innards reassembled on the bench, as how they would be inside the casings. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_205201744_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_205755472_HDR.jpg" class="kg-image"></figure><p>And everything <a href="https://www.plasticboxshop.co.uk//home-storage-c1/bedroom-and-bathroom-organisation-c16/toy-storage-boxes-c17/pack-of-3-21-litre-multi-maxi-plastic-storage-box-p70/s7290">packed</a> away ready for the next step, which will probably be degrotting of all the parts.<br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190224_212323156_HDR.jpg" class="kg-image"></figure>]]></content:encoded></item><item><title><![CDATA[Talking in modbus]]></title><description><![CDATA[<p>At work we have a datacenter, so we have things that require monitoring like generators, air handlers (industrial aircon to keep the servers cool), and uninterruptible power supplies. Our building monitoring system was originally written by a colleague that has long since left and the responsibility of maintaining it has</p>]]></description><link>https://blog.ab5w.com/talking-modbus/</link><guid isPermaLink="false">5c6f42573eaf2555e8ba5740</guid><category><![CDATA[work]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Fri, 22 Feb 2019 01:48:28 GMT</pubDate><content:encoded><![CDATA[<p>At work we have a datacenter, so we have things that require monitoring like generators, air handlers (industrial aircon to keep the servers cool), and uninterruptible power supplies. Our building monitoring system was originally written by a colleague that has long since left and the responsibility of maintaining it has fallen to me. The monitoring works fairly well, with a few issues that I had to resolve which I will talk about here. The main issue I encountered was that the generators would occasionally stop responding to queries, they would also not notify properly if they were running. Thankfully they are loud enough to hear in the office if they are running, so there is no worry about us not noticing. We have also never had a time we have had to run on generators that wasn't a power drop test since the datacenter was built (touch wood!). They are also checked at the start of each shifts walkaround to ensure they are in the correct mode/no warning lights showing. <br><br>There wasn't much documentation left on how the modbus stuff works for talking to them, so I had to work it all out. First I started by reading the <a href="https://en.wikipedia.org/wiki/Modbus">wikipedia</a> page for modbus, so I could get an idea of what it actually is. To save you a click, if you are lazy; it's a serial communications protocol for programmable logic controllers. Though we actually talk to the generators over TCP, not serial. I also managed to find a PDF online for the <a href="http://eccoengenharia.com.br/files/gencomm.pdf">registers</a> for the <a href="https://www.deepseaplc.com/genset/load-sharing-synchronising-control-modules/dse8610">control panel</a>. </p><p>We are using <a href="https://www.modbusdriver.com/modpoll.html">modpoll</a> as a master for polling the clients (generators), so my next task was to figure out how you get the register address number needed to send to the generator so it could reply with another number that was either the actual value of thing you queried (like fuel level or battery voltage), or a status code (for things like alarms/control state). It turns out that it requires maths, I guess that does make sense since it's for logic boards.. What you have to do is get the "page number" from the list of register tables (which is the more the table number than anything), then times it by 256 and add the register offset from the table.<br></p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/Screen-Shot-2019-02-22-at-01.06.36.png" class="kg-image"></figure><p> So to find the control mode register address using the registers above we do the following:</p><p>(3 x 256) + 4 = 772<br><br>Then when polled it will return one of the mode numbers below</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/Screen-Shot-2019-02-22-at-01.06.11-1.png" class="kg-image"></figure><p>Fairly easy once you get your head around it. </p><pre><code># modpoll -c 1 -m tcp 192.168.0.2 -1 -0 -r 772
modpoll 3.4 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2013 proconX Pty Ltd
Visit http://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: MODBUS/TCP
Slave configuration...: address = 1, start reference = 772 (PDU), count = 1
Communication.........: 192.168.0.2, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, output (holding) register table

-- Polling slave...
[772]: 1</code></pre><p>Next up was trying to find a register for if the engine was running. I did find one for engine status, but even when we started a generator up it would return an invalid mode. I contacted <a href="https://www.deepseaplc.com/">DSE</a> support to query this and they said that since that register is an ECU one, you're not able to query it correctly. What we could do was query for the engine RPM and if it's under a value of something like 600 it's safe to assume that it's not running. This worked really well on the tests we did. I also have to say that DSE technical support is outstanding, considering we haven't paid for anything other than the original panels with the gensets. They replied very promptly to queries, and assisted with troubleshooting issues without complaints! <br><br>Next up was the issue with the generators deciding not to talk back to us after a while. The original monitoring scripts were set to query each generator for about 15 different registers every minute, they also did one poll per register. So my guess is that the poor little control panels were effectively being denial of serviced with 15 individual queries to handle every minute. The procedure to reboot the panel so it will talk again is fairly involved as well, you have to open up the control box the panel lives in and unscrew the terminal block screw allowing you to remove the 12v positive wire to the control board, then waiting a few seconds and putting it back in/tightening up the screw. I also worked out that with modpoll you can query a register range, so if you are querying the same registers page you can pull out a number of queries at the same time. This meant that we could cut the 15 queries down to 3; for control mode, engine status, and alarms. We also only really need to check if the engines are running every minute, everything else can be checked every 10 minutes. </p><pre><code># modpoll -c 6 -m tcp 192.168.0.2 -1 -0 -r 48897
modpoll 3.4 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2013 proconX Pty Ltd
Visit http://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: MODBUS/TCP
Slave configuration...: address = 1, start reference = 48897 (PDU), count = 6
Communication.........: 192.168.0.2, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, output (holding) register table

-- Polling slave...
[48897]: 0
[48898]: 0
[48899]: 0
[48900]: 0
[48901]: 0
[48902]: 0</code></pre><p>The scripts themselves were written in PHP which is good as that's my jam. So I was able to easily update how they worked to incorporate the new changes. The main changes were the splitting of the queries for different timed crons, creating a modpoll function to handle it returning more than one value, and to update the existing queries to use the new functions output.</p><pre><code>function modpoll_dse($ip,$register_start,$count) {

    $output = shell_exec("modpoll -c " . $count . " -m tcp " . $ip . " -1 -0 -r " . $register_start);

    preg_match_all('/\[[0-9]+\].*/', $output, $matches);

    foreach ($matches[0] as $output) {

        $output = explode(':', $output);
        preg_match_all('/\d+/', trim($output[0]),$register);
        $register = $register[0][0];

        $value = trim($output[1]);

        $register_values[$register] = $value;

    }

    return $register_values;

}</code></pre><p>Then using the same values as the modpoll example above;</p><pre><code>$modpoll_dse = modpoll_dse($ip,'48897','6');</code></pre><pre><code>Array
(
    [48897] =&gt; 0
    [48898] =&gt; 0
    [48899] =&gt; 0
    [48900] =&gt; 0
    [48901] =&gt; 0
    [48902] =&gt; 0
)</code></pre><p>The output is stored in a database, which used to get sent to nagios via a passive check but I changed this to push to a dashboard we could put up on a big TV in the office that updates every minute. That way people can see if there is an issue with a simple glance at it for colour changes. The dashboard is using the <a href="https://smashing.github.io/">smashing</a> framework. It's really cool, you can just curl your data to the endpoint you create and it updates. I modified the <a href="https://github.com/aelse/dashing-health">health</a> widget to handle our alerts, if something goes over a threshold, or a status changes the box for that unit goes red otherwise it's green. There is one health widget for each of the units that is monitored, and a separate update script sets the colours based on what text is pushed to the dashboard. Critical (red) alerts/recoveries are also pushed to a slack channel for the infra team on shift, as well as direct messages for the datacenter manager/escalation points.</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/Screen-Shot-2019-02-22-at-19.12.35.png" class="kg-image"></figure><p>Since changing the query timing the generators have behaved themselves and haven't stopped talking to us, the slack notifications have also worked very well for letting people know what's going on.</p><p></p>]]></content:encoded></item><item><title><![CDATA[Krumpi (Paprikás krumpli)]]></title><description><![CDATA[<p>If you like onions, potatoes, and (lots of) paprika then this recipe is for you. This was originally taught to me by my Hungarian friend. It's a very easy and a very tasty meal to make. Lots of leftovers make for great work lunches. <br><br>For originality you should use hungarian</p>]]></description><link>https://blog.ab5w.com/krumpi/</link><guid isPermaLink="false">5c6f30933eaf2555e8ba5731</guid><category><![CDATA[cooking]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Thu, 21 Feb 2019 23:44:24 GMT</pubDate><content:encoded><![CDATA[<p>If you like onions, potatoes, and (lots of) paprika then this recipe is for you. This was originally taught to me by my Hungarian friend. It's a very easy and a very tasty meal to make. Lots of leftovers make for great work lunches. <br><br>For originality you should use hungarian paprika, however as this is hard to find in the supermarkets using spanish is fine. I recommend looking in the world foods section, they generally have 100g packets for about 70p instead of £2 for one of those tiny jars.. <br><br>You can also add other root veggies like carrots with potatoes if you want to, they just need to be chopped into bite sized pieces. <br><br>Ingredients:</p><ul><li>1 large onion diced</li><li>4-5 large potatoes (or equivalent) cut into chunks</li><li>3 tbsp paprika</li><li>1 tsp caraway seeds </li><li>meat or veggie hotdogs chopped (optional)</li><li>salt/pepper</li><li>olive oil</li><li>water<br></li></ul><p>Method:</p><ol><li>Heat a large pan and add a generous amount of  oil</li><li>Add the caraway seeds and fry for a minute</li><li>When the seeds are toasty add the onions and fry with the lid on until they are translucent</li><li>Add the potatoes and fry for a few minutes</li><li>Remove the pan from the heat and sprinkle the paprika over, then stir in (if you don't remove the pan you risk burning the paprika and ruining the dish)</li><li>Put it back on the heat, stirring for a minute or two</li><li>Add enough water to just cover the potatoes</li><li>Bring to the boil, put the lid back on and simmer covered for 30 minutes</li><li>Take the lid off and continue to simmer for 20 minutes or until suitably reduced (it should almost be like a chunky soup)</li><li>If you are adding hotdogs, put them in about 5 minutes before the end to heat up.</li><li>Season with salt/pepper before serving</li></ol><p>Photos:</p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190204_210309153_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190204_210714555_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190204_211049876_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190204_211211690_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190204_211254449_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190204_211345435_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190204_211507426_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190204_220618642_HDR.jpg" class="kg-image"></figure><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/02/IMG_20190204_221236443_HDR.jpg" class="kg-image"><figcaption>Dinner plus four work lunches!</figcaption></figure>]]></content:encoded></item><item><title><![CDATA[Tank]]></title><description><![CDATA[<p>Meet tank, my favourite car I thought I'd never buy. He's a VW Polo, with a 1.9SDI engine. Yes, that's a non turbo diesel. Which is where his name comes from. He sounds like a tank and is about as fast (with his 64bhp). He came into my life</p>]]></description><link>https://blog.ab5w.com/tank/</link><guid isPermaLink="false">5c52220b3eaf2555e8ba572b</guid><category><![CDATA[life]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Wed, 30 Jan 2019 23:19:04 GMT</pubDate><content:encoded><![CDATA[<p>Meet tank, my favourite car I thought I'd never buy. He's a VW Polo, with a 1.9SDI engine. Yes, that's a non turbo diesel. Which is where his name comes from. He sounds like a tank and is about as fast (with his 64bhp). He came into my life after my Skoda Fabia (which I have never written about before) encountered some gearbox issues. It's (Limey) mechatronic unit failed, it was originally diagnosed as the dual clutch unit which was then changed by the "gearbox specialist" and they said it was good, but then it wasn't. There is nothing like driving your car on the so called "13 bends of death" road, and it only deciding it wants to go into even gears (and reverse as it uses the same clutch). Thankfully I got home fine, with some jerky shifting due to the only even gear preference. So it went back to the "specialist" and there it has remained whilst they try to figure it out, it's had a new mech unit but they can't get it to go into reverse. It's been there for a while. I was car sharing my mothers car but that was getting difficult and resulted in a lot of working from home plus the loss of freedom of just having your own wheels. I did drive the series into work a few times, but that developed it's own issues of stalling everytime it came to a stop (not awesome at junctions), plus the whole gearbox issue that's resulting in the (very slow) rebuild project. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/01/46932755251_d7516fcd7d_b.jpg" class="kg-image"></figure><p><br>I'd mentioned possibly buying some cheap car to tide me over to my dad so I didn't have to keep using my mothers car. His friend owns a garage, which had a polo for sale. After a short test drive Tank was mine for the pricely sum of £550. He had some issues, but who cares for that price? The rear brakes were shot and needed replacing/the handbrake reach was high, and the rear wiper/washer didn't work, and he needed front tyres. I got the brakes/handbrake sorted by the garage. That cost me around £200. The front tyres were replaced for around £70. I asked the tyre guy for the cheapest ones as he was just a temp car at the time. I took Tank camping on a farm with my farmer friend, he got muddy. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/01/32104600978_fd6cb0d097_b-1.jpg" class="kg-image"></figure><p><br>He was surprisingly good offroad, on the fields and on the bits between fields on which I would be hesitant to drive the skoda on. He even crossed them with the back full of logs and camping stuff, basically on the bump stops. At Christmas camping this year we loaded the back with all the logs and I reversed him down the field, he makes a good work horse. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/01/27d63b82-23bf-4e00-8806-372ae964c9f4.jpeg" class="kg-image"></figure><p>Photo credit <a href="https://www.instagram.com/thewatchingeye0099/">@thewatchingeye0099</a></p><p>With all the commuting to work and other driving I've been getting 55mpg from him which is way more than any of my other cars. The Skoda is around 33mpg and the series... maybe 15 at best? His rear wiper not working cost £15 for a second hand motor from ebay. </p><figure class="kg-embed-card"><div style="position:relative;padding-bottom: calc(177.75% + 44px)"><iframe src="https://gfycat.com/ifr/InbornUnsungAmericanrobin" frameborder="0" scrolling="no" width="100%" height="100%" style="position:absolute;top:0;left:0;" allowfullscreen></iframe></div></figure><p>The washer was a bit more involved, and required removing about half the engine bay to get to where the pipe had become disconnected due to being crushed and had caused the connector to pop off the pump connection as well, but I managed it in the end. I think I'm about £1200 all in, with initial cost + insurance + tax + repairs, which isn't too bad considering. Though the water temperature gauge has started to play up.. so that's the next thing. Sensor or thermostat..? We will see.. He is 16 years old, teenager issues. </p><figure class="kg-image-card"><img src="https://blog.ab5w.com/content/images/2019/01/46208078074_2dba4387d0_b.jpg" class="kg-image"></figure><p>I'm really enjoying driving him so far though, he's definitely a keeper. When the Skoda is eventually fixed I'm going to get rid of it and keep him. Future things to get done are the cambelt/aux belt as I don't know when they were last done. Then whichever issues crop up.. </p>]]></content:encoded></item><item><title><![CDATA[Project Gearbox, part 1]]></title><description><![CDATA[<p>My landrover series's gearbox is a bit ropey, it's definitely seen better days and judging by the blue instant gasket that has oozed out between the mating plates at least one previous owner has been inside it. Everything else I have discovered that's wrong with the landy has been due</p>]]></description><link>https://blog.ab5w.com/project-gearbox-part-1/</link><guid isPermaLink="false">5b8885be7abcd83ad96d7d4c</guid><category><![CDATA[projects]]></category><category><![CDATA[rebuild]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Wed, 22 Aug 2018 03:36:55 GMT</pubDate><content:encoded><![CDATA[<p>My landrover series's gearbox is a bit ropey, it's definitely seen better days and judging by the blue instant gasket that has oozed out between the mating plates at least one previous owner has been inside it. Everything else I have discovered that's wrong with the landy has been due to a previous owners bodge job, so I'm wondering what horrors lay within the gearbox. The main issues I have are; it doesn't go in/out of 1st and 2nd very well, when it does want to go into 2nd it will normally scrunch, sometimes you can't find 1st or 2nd at all at a stop (which is fun at junctions). Thankfully it will pull away in 3rd with some gentle loud pedal and some clutching. There is also a very noisy bearing whine from the general bell housing/gearbox area that goes away when the clutch pedal is depressed, it can be heard over the engine at idle. Other than this it drives fine, and once it's in gear it's fine it doesn't jump out or anything.</p>
<p>I had been looking into getting the gearbox/transfer case rebuilt by a company but that also runs into issues. The place that people seem to recommend the most isn't currently taking orders and were fairly expensive, and the others are either humongously expensive or have mixed reviews. So I started to look into what it would take to rebuild it myself, and it doesn't look too terible. It's just bearings, seals, and endfloat. How hard can it be? I have the workshop manual and there are some good <a href="http://www.geoffslandroverblog.com/">blogs</a>/videos (<a href="https://www.youtube.com/watch?v=_yzUH1faG5Y">1</a>/<a href="https://www.youtube.com/watch?v=S-CyOvRJQo8">2</a>) on it from people who have done theirs.</p>
<p>My plan was to buy a second hand box off ebay to rebuild, then swap it with my box once complete. I can then marvel in the delights/horrors that lie within mine when it's on the bench, and still have a working landrover thoughout the whole process. So with this I started to look at ebay every so often for a decent box that was either close or had delivery. Sadly most of the ones listed seem to either be early series 2/2a boxes that don't have full syncromesh or were collection only and the opposite side of the country. Eventually one did come up that was a complete series 3 box and was fairly close for collection. It was up for £270 but I put an offer in for £200 that was accepted.</p>
<p>My friend was super awesome and helped me collect it, he has a defender so perfectly fitting for collecting landrover parts. Here it is strapped down in the back.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/44186252231/in/dateposted/"><img src="https://c2.staticflickr.com/2/1831/44186252231_31cce868e9_c.jpg" alt=""></a></p>
<p>Landrover series gearbox/transfer cases are <em>heavy</em>. I knew that it would be fairly hefty but figured it would be manageable with two people, not a struggle. Once home it was placed in the back of the series. I did a lookover of it and discovered that the guy I bought it from did not drain the oil from the boxes as he said he would. This presented an issue as I had to remove the oil before I could split the gearbox from the transfer case but I couldn't lift it up to gain access to the drain plugs as our drive is gravel and sloping, no good for a crane. I managed to tip most of the oil out of the main box from the fill plug. For the transfer case a cheap oil/fluid transfer pump was sourced from Amazon, it's the finest chinesium but doesn't seem too bad for the price. The inspection plates were removed and the hose poked in. The pump was connected up to an old car battery that was lurking in the garage, and slowly but surely it sucked all the oil out.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/30318441808/in/dateposted/"><img src="https://c2.staticflickr.com/2/1854/30318441808_ccd3554cbf_c.jpg" alt=""></a></p>
<p>Once that was done, it was onto the splitting of the boxes. The fairly simple looking instructions..</p>
<p><a href="https://www.flickr.com/photos/ab_sw/44185695591/in/dateposted/"><img src="https://c2.staticflickr.com/2/1864/44185695591_02b935e0d8_c.jpg" alt=""></a></p>
<p>The first thing to do was to remove all the levers so I could turn the box upside down. This is where I ran into my first fully whitworth fastening of the day (and first of many to come). Fully as in nothing metric or imperial was close to fitting it. It was 1/4 and the bolt/nut was the one holding the red high/low lever in place. In the picture it's in the middle closest to the floor (looking from above).</p>
<p><a href="https://www.flickr.com/photos/ab_sw/43467634634/in/dateposted/"><img src="https://c2.staticflickr.com/2/1859/43467634634_e4e2f65c88_c.jpg" alt=""></a></p>
<p>Also in the picture at the top is the clevis pin that holds the yellow knob lever to the lever on the transfer box. This came undone quite easily with a screwdriver (dispite the rusty look) once the tiny split pin on the other side was removed.</p>
<p>Once the bolt was removed, it was just a case of awkwardly removing the lever downwards, with some tipping of the box require due to it being in the back of the series. I imagine it's much easier if the box is still in place. Making sure I didn't lose the little spring clip that locates the ball into the pivot hole.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/30318588538/in/dateposted/"><img src="https://c2.staticflickr.com/2/1812/30318588538_97107ffc76_c.jpg" alt=""></a></p>
<p>The main gear lever was also unbolted.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/42377983560/in/photostream/"><img src="https://c2.staticflickr.com/2/1863/42377983560_91e4330e66_c.jpg" alt=""></a></p>
<p>All small bits were placed into labeled bags.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/44137638752/in/photostream/"><img src="https://c2.staticflickr.com/2/1876/44137638752_d743ecb101_c.jpg" alt=""></a></p>
<p>The next stage was to remove the transmission brake drum, so I could get to the nuts that hold the drum/brake plate to the transfer case. I spent a bit of time trying to figure this out as I removed all the small nuts that surrounded the front of the drum and it still wouldn't come off, at this point I decided to consult the manual and it turns out you only need to remove the large 1&quot; castellated nut (with split pin) on the output shaft.. (doh!).</p>
<p><a href="https://www.flickr.com/photos/ab_sw/43467763984/in/photostream/"><img src="https://c2.staticflickr.com/2/1817/43467763984_4e279d877b_c.jpg" alt=""></a></p>
<p>In the picture you can see part of the brake actuator mechanism sitting on the bottom brake shoe instead of in it's rightful place. In the manual it says to remove the hand brake linkage however it was rusted up solid so the backing plate was unbolted with it still attached and all fastenings and small parts were placed into a labeled bag. The big parts were placed into a handy cardboard box for later overhauling.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/30318616408/in/photostream/"><img src="https://c2.staticflickr.com/2/1845/30318616408_6a50695b67_c.jpg" alt=""></a></p>
<p>What we are left with</p>
<p><a href="https://www.flickr.com/photos/ab_sw/42378014320/in/dateposted/"><img src="https://c2.staticflickr.com/2/1870/42378014320_17025f72fb_c.jpg" alt=""></a></p>
<p>Next up was to remove the outer fixings that hold the transfer case to the main box. There are five and they are all whitworth. The top most two are 1/4 and the rest 5/16. The two top ones were very rusty and not very well lubricated so I had to use the breaker bar with a spanner braced against the casing to undo the nuts.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/43280323355/in/dateposted/"><img src="https://c2.staticflickr.com/2/1873/43280323355_144fdd15b9_c.jpg" alt=""></a></p>
<p>Of the remaning three, two were captive studs and one was a bolt and nut. They came undone with relative ease due to being covered with gearbox oil/oily grot for years, I put the spanner on them and tapped it with the rubber mallet to free them off, then undid them with the socket and ratchet. There is a small bolt sitting in a recess that I'm not entirely sure what it's for, but it's removal was not needed. I'm sure I will find out it's purpose in due course (some kind of stop for the gear selectors?). To the right of it you can see one of the 5/16 nuts to remove.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/43467787874/in/dateposted/"><img src="https://c2.staticflickr.com/2/1880/43467787874_f5183c1d53_c.jpg" alt=""></a></p>
<p>It was now time to flip the box upside down so I could access the transfer case cover. I decided to put some cardboard down instead of the bubble wrap it had been sitting on before (to stop grot getting on the carpet too much). It was at this point I discovered that when you turn the box upside down any remaining oil in the gearbox will flow out of the holes that the gear change lever bracket bolts into.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/43280334765/in/dateposted/"><img src="https://c2.staticflickr.com/2/1838/43280334765_03c9d0e01e_c.jpg" alt=""></a></p>
<p><a href="https://www.flickr.com/photos/ab_sw/44185699561/in/dateposted/"><img src="https://c2.staticflickr.com/2/1812/44185699561_c67da76e05_c.jpg" alt=""></a></p>
<p><a href="https://www.flickr.com/photos/ab_sw/44137676492/in/dateposted/"><img src="https://c2.staticflickr.com/2/1820/44137676492_5e29116023_c.jpg" alt=""></a></p>
<p><a href="https://www.flickr.com/photos/ab_sw/44185705031/in/dateposted/"><img src="https://c2.staticflickr.com/2/1840/44185705031_20a48f3df3_c.jpg" alt=""></a></p>
<p>Now that the box was upside down and my rear tow ball had been given some some extra rust prevention, it was time to remove the transfer case cover in preparation of removing the intermediate gear. The nuts are 7/16 and I had encounted them before on my own orginal box when I replaced the leaky cover. I found that most of the studs came out instead of the nuts coming off. There was only one where the stud remained. I will have to see if these should be loctited in on reassembly.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/30318648408/in/dateposted/"><img src="https://c2.staticflickr.com/2/1845/30318648408_379b12808a_c.jpg" alt=""></a></p>
<p>The gears look in pretty good nick, and all spin nicely. Though I will still replace the bearings when I get a overhaul kit. Next up is removing the rear output shaft bearing cover (to the right in the above picture), this just involves removing the nuts (or studs if they come undone) and then gently levering the cover away from the case. I accidently neglected to take pictures of this.</p>
<p>To remove the shaft that the intermediate gear sits on you need to remove another 5/16W locking nut and then use &quot;Service Tool 605862&quot; to remove the shaft. I don't have a service tool but I do have a crowbar that serves the same purpose. No great force is required to remove it, just lever it fowards then it will come out by hand. Making sure you support the gear with your other hand.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/44185724401/in/dateposted/"><img src="https://c2.staticflickr.com/2/1875/44185724401_fce80d429b_c.jpg" alt=""></a></p>
<p>The gear can then be rolled out of the case and it turns out there are two needle roller bearings inside it, that the shaft goes though. As they fell out when I lifted it out.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/43467807564/in/dateposted/"><img src="https://c2.staticflickr.com/2/1859/43467807564_cea1e3fdb2_c.jpg" alt=""></a></p>
<p><a href="https://www.flickr.com/photos/ab_sw/44137713732/in/dateposted/"><img src="https://c2.staticflickr.com/2/1871/44137713732_ba20d5a13a_c.jpg" alt=""></a></p>
<p>With the gear removed it's just a case of removing the last 3 nuts that hold the cases together. I put a socket on them and then gently tapped the ratchet with the rubber mallet to free them off, then used just the socket in my fingers to spin the nuts off as they are recessed. Thankfully as they live in an oil bath they were very easy to undo.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/44137710772/in/dateposted/"><img src="https://c2.staticflickr.com/2/1876/44137710772_a27f7a984a_c.jpg" alt=""></a></p>
<p>Lastly it's just a case of gently tapping the cases apart with the rubber mallet to get them moving. Then carefully pulling the gearbox output gear though the hole in the transfer case.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/30318662468/in/dateposted/"><img src="https://c2.staticflickr.com/2/1868/30318662468_bf153a4143_c.jpg" alt=""></a></p>
<p>Once separated, the transfer case is fairly easy to move. I was able to lift/carry it to the garage. The main gearbox is an absolute unit in comparison (small but dense) and will require assistance to move.</p>
<p><a href="https://www.flickr.com/photos/ab_sw/30318666328/in/dateposted/"><img src="https://c2.staticflickr.com/2/1843/30318666328_4dd7a42209_c.jpg" alt=""></a></p>
<p><a href="https://www.flickr.com/photos/ab_sw/43280374965/in/dateposted/"><img src="https://c2.staticflickr.com/2/1886/43280374965_3f924dfc1d_c.jpg" alt=""></a></p>
<p>My next step is to clean up the parts removed that are in the cardboard box, so they can be stored. Then I will teardown the transfer case and clean the casing. The mainbox will also be moved to the garage.</p>
]]></content:encoded></item><item><title><![CDATA[Project Daylight]]></title><description><![CDATA[<h3 id="addingaledlightbartopugly">Adding a LED lightbar to pugly.</h3>
<h4 id="overview">Overview</h4>
<p>My daily driver is a <a href="https://en.wikipedia.org/wiki/Peugeot_1007">Peugeot 1007</a>. It's pretty nifty and unique  which is one of the reasons I love it so much, However it's illumination is somewhat lacking, even with the full beams on and with decent <a href="http://www.amazon.co.uk/BREAKER-UNLIMITED-64193NBU-HCB-Halogen-Headlamp/dp/B00EPLCP3U/">bulbs</a>. So I came up</p>]]></description><link>https://blog.ab5w.com/project-daylight/</link><guid isPermaLink="false">5b8885be7abcd83ad96d7d4b</guid><category><![CDATA[projects]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Sat, 05 Mar 2016 08:04:02 GMT</pubDate><content:encoded><![CDATA[<h3 id="addingaledlightbartopugly">Adding a LED lightbar to pugly.</h3>
<h4 id="overview">Overview</h4>
<p>My daily driver is a <a href="https://en.wikipedia.org/wiki/Peugeot_1007">Peugeot 1007</a>. It's pretty nifty and unique  which is one of the reasons I love it so much, However it's illumination is somewhat lacking, even with the full beams on and with decent <a href="http://www.amazon.co.uk/BREAKER-UNLIMITED-64193NBU-HCB-Halogen-Headlamp/dp/B00EPLCP3U/">bulbs</a>. So I came up with the idea of adding some driving lights (mostly for countrylanes). Initially  it was just a pipe dream, but recently I was browsing eBay and I bought a cheap china LED bar.. which made the project a reality.</p>
<h4 id="plan">Plan</h4>
<p>My overall idea was for the light to only be able to be used with the full beams on, and then only if it was enabled by a switch. This way it's legal and can't accidently be turned on with the normal dipped headlights. After discussing the plan with my friend he kindly made a wiring diagram for me (as this is my first big electrics project).</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25366602152/in/album-72157665231809462/" title="lightbar_wiring_diagram"><img src="https://farm2.staticflickr.com/1478/25366602152_4701837427_c.jpg" width="800" height="617" alt="lightbar_wiring_diagram"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>With the headlights on I used a multimeter to determine which of the cables on the bulb socket was for the high beams. This is the cable that would be tapped to power the coil side of the relay. I also decided that the light bar will be fixed to the roof with some hench magnets, this is less destructive than modifying the front bumper/grill for a mount and will allow for it to be easily removed if it needs to be.</p>
<p>With the diagram and the plan, it was time to assemble the components.</p>
<h4 id="bitsandbobsused">Bits and bobs used.</h4>
<p>Links where available.</p>
<h5 id="parts">Parts</h5>
<ul>
<li><a href="http://www.ebay.co.uk/itm/231848900905">LED Light bar</a></li>
<li><a href="http://www.ebay.co.uk/itm/281939235327">Relay</a></li>
<li><a href="http://www.ebay.co.uk/itm/391102466502">Spade connectors</a></li>
<li><a href="http://www.ebay.co.uk/itm/221995780417">Fuse piggyback connector</a></li>
<li><a href="http://www.ebay.co.uk/itm/300915885740">Positaps</a></li>
<li><a href="http://www.ebay.co.uk/itm/321923171152">Switch</a></li>
<li><a href="http://www.ebay.co.uk/itm/321326436914">2mm wire</a> (5m red/5m black)</li>
<li>Various sized heat shrink tubing.</li>
<li>Misc crimp connectors</li>
<li><a href="http://e-magnetsuk.com/magnet_products/clamping_magnets/car_roof_top_magnets.aspx">Car roof magnets</a> (102mm x 127mm x 12mm)</li>
</ul>
<h5 id="tools">Tools</h5>
<ul>
<li>Wire stripper/crimper</li>
<li>Pliers</li>
<li>T20 Torx screwdriver</li>
<li>Multimeter</li>
<li>Jet lighter for the heat shrink</li>
<li>10mm spanner</li>
<li>Drill with 10mm bit</li>
</ul>
<h5 id="picturesoftheinstall">Pictures of the install</h5>
<p>Constructing the negative earth cable.</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25467254615/in/album-72157665231809462/" title="Snapchat-6998929899755387114"><img src="https://farm2.staticflickr.com/1467/25467254615_52ddba1b53_c.jpg" width="450" height="800" alt="Snapchat-6998929899755387114"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Negative earth cable secured to engine bolt (10mm spanner)</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25099691849/in/album-72157665231809462/" title="Snapchat-7372686599808632519"><img src="https://farm2.staticflickr.com/1506/25099691849_bb0208d3bf_c.jpg" width="450" height="800" alt="Snapchat-7372686599808632519"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25099720179/in/album-72157665231809462/" title="Snapchat-144193163712909457"><img src="https://farm2.staticflickr.com/1616/25099720179_02525f8454_c.jpg" width="800" height="450" alt="Snapchat-144193163712909457"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Relay connected up</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/24836709484/in/album-72157665231809462/" title="Snapchat-3148747544289282102"><img src="https://farm2.staticflickr.com/1445/24836709484_441ca2f2f4_c.jpg" width="450" height="800" alt="Snapchat-3148747544289282102"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25348802882/in/album-72157665231809462/" title="Snapchat-8887412185237999703"><img src="https://farm2.staticflickr.com/1681/25348802882_52d4bf523d_c.jpg" width="800" height="450" alt="Snapchat-8887412185237999703"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Piggyback fuse connector in place for the power feed for the light bar</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25394655831/in/album-72157665231809462/" title="2016-03-04_02-58-04"><img src="https://farm2.staticflickr.com/1614/25394655831_f8f4e2cae8_c.jpg" width="800" height="450" alt="2016-03-04_02-58-04"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25487483775/in/album-72157665231809462/" title="2016-03-04_02-58-20"><img src="https://farm2.staticflickr.com/1559/25487483775_9115c5d14d_c.jpg" width="800" height="450" alt="2016-03-04_02-58-20"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Covers back on</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/24836682434/in/album-72157665231809462/" title="Snapchat-8081144504506036473"><img src="https://farm2.staticflickr.com/1568/24836682434_77b9ed5014_c.jpg" width="800" height="450" alt="Snapchat-8081144504506036473"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>High beam wire tapped</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25171791560/in/album-72157665231809462/" title="20160303_082530"><img src="https://farm2.staticflickr.com/1679/25171791560_f1d9f138eb_c.jpg" width="450" height="800" alt="20160303_082530"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/24836714364/in/album-72157665231809462/" title="Snapchat-2940235741923936502"><img src="https://farm2.staticflickr.com/1716/24836714364_cf8a5db5b5_c.jpg" width="450" height="800" alt="Snapchat-2940235741923936502"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Feeding wires through the firewall for the switch in the cabin</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25348919462/in/album-72157665231809462/" title="20160303_082600"><img src="https://farm2.staticflickr.com/1585/25348919462_0261c61859_c.jpg" width="800" height="450" alt="20160303_082600"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Wires cabin side</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/24858616583/in/album-72157665231809462/" title="2016-03-04_01-03-02"><img src="https://farm2.staticflickr.com/1575/24858616583_787e377f6c_c.jpg" width="800" height="450" alt="2016-03-04_01-03-02"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25366887512/in/album-72157665231809462/" title="2016-03-04_01-03-23"><img src="https://farm2.staticflickr.com/1710/25366887512_cd545ff101_c.jpg" width="800" height="450" alt="2016-03-04_01-03-23"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Drilling hole in the dash panel for the switch</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/24836791074/in/album-72157665231809462/" title="20160303_084229"><img src="https://farm2.staticflickr.com/1584/24836791074_85ddcd32e6_c.jpg" width="800" height="450" alt="20160303_084229"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>I discovered that the 10mm hole was too small for the switch thread, so I had to ream the hole out with a 12mm cold chisel.</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25374466991/in/album-72157665231809462/" title="20160303_085801"><img src="https://farm2.staticflickr.com/1634/25374466991_5a5e6a431a_c.jpg" width="450" height="800" alt="20160303_085801"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>A piece of pugly had to be sacrificed to allow the switch to fit.</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/24836771684/in/album-72157665231809462/" title="20160303_090411"><img src="https://farm2.staticflickr.com/1460/24836771684_d52eb047f8_c.jpg" width="450" height="800" alt="20160303_090411"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25171692300/in/album-72157665231809462/" title="Snapchat-386113948318665776"><img src="https://farm2.staticflickr.com/1551/25171692300_5dba520af9_c.jpg" width="450" height="800" alt="Snapchat-386113948318665776"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Feeding the switch wires through.</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/24836695114/in/album-72157665231809462/" title="Snapchat-7288918283161417918"><img src="https://farm2.staticflickr.com/1631/24836695114_d0c3374fba_c.jpg" width="800" height="450" alt="Snapchat-7288918283161417918"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Spade connectors added and wires heatshrinked.</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25467259385/in/album-72157665231809462/" title="Snapchat-5336323267662252111"><img src="https://farm2.staticflickr.com/1445/25467259385_a02825f3ea_c.jpg" width="800" height="450" alt="Snapchat-5336323267662252111"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Switch wired up.</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25099683419/in/album-72157665231809462/" title="Snapchat-8400006341110757084"><img src="https://farm2.staticflickr.com/1441/25099683419_9b7052b4e7_c.jpg" width="450" height="800" alt="Snapchat-8400006341110757084"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Dash panel refitted.</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/24836685964/in/album-72157665231809462/" title="Snapchat-7696456889657966105"><img src="https://farm2.staticflickr.com/1528/24836685964_18e894467b_c.jpg" width="450" height="800" alt="Snapchat-7696456889657966105"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Light bar fitted to roof, it's virtually impossible to move the bar with the magnets. They are very strong.</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25374388271/in/album-72157665231809462/" title="Snapchat-5171008782490527940"><img src="https://farm2.staticflickr.com/1486/25374388271_96a48ccecd_c.jpg" width="800" height="450" alt="Snapchat-5171008782490527940"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Wire ran down side of windscreen (under the body panel).</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25171686760/in/album-72157665231809462/" title="Snapchat-3120838578412466890"><img src="https://farm2.staticflickr.com/1711/25171686760_4f5a8ff1f0_c.jpg" width="450" height="800" alt="Snapchat-3120838578412466890"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<p>Front view of the completed install.</p>
<p><a data-flickr-embed="true" href="https://www.flickr.com/photos/ab_sw/25348885822/in/album-72157665231809462/" title="20160303_094429"><img src="https://farm2.staticflickr.com/1702/25348885822_5fb61a506a_c.jpg" width="800" height="450" alt="20160303_094429"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script></p>
<h4 id="video">Video</h4>
<p>Video of it in action.</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/C5FvoWnfgS4" frameborder="0" allowfullscreen></iframe>
<h5 id="todos">Todos</h5>
<ul>
<li>Better insulate  relay connections, to prevent shorts. At the moment I have just added some loose heatshrink tubing.</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Nagios lookup.]]></title><description><![CDATA[<p>I wanted an easy way to query our nagios server to see which hosts are being monitored and what checks they have assigned to them for auditing. I also wanted it to be speedy as no one wants to wait 30 seconds for a lookup, so some kind of caching</p>]]></description><link>https://blog.ab5w.com/nagios-lookup/</link><guid isPermaLink="false">5d1cd5cad532dd290a1beed6</guid><category><![CDATA[work]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Tue, 27 Oct 2015 16:13:00 GMT</pubDate><content:encoded><![CDATA[<p>I wanted an easy way to query our nagios server to see which hosts are being monitored and what checks they have assigned to them for auditing. I also wanted it to be speedy as no one wants to wait 30 seconds for a lookup, so some kind of caching was needed. It uses redis for the backend, with the the hosts IP as the key and the hosts info (in a json array) as the value.</p><p>The generate script first parses the localhost.cfg into a PHP array with a sub array for each host like so:</p><script src="https://gist.github.com/ab5w/3a4bddd7d0a801415875.js"></script><p>It then loops through the array of hosts to get the service checks specified for each host from the nagios config. The results are then constructed into a new array for each host which is then json_encoded() and set in redis with the hosts IP address as the key.</p><p>Full script is:</p><script src="https://gist.github.com/ab5w/17c42dfbf4a3c30d3fbc.js"></script><p>The generate script is ran via cron every so often, however I have also modified our in-house nagios editor so when a host is added/edited it updates the array stored in redis for the IP, and if you delete a host it removes it from redis.</p><p>The lookup endpoint is then just a simple PHP script (it sits behind a firewall for security) that either returns a json array of all IPs in nagios, or if an IP is specified the details for that host in a json array.</p><script src="https://gist.github.com/ab5w/813571bef958c8b39618.js"></script>]]></content:encoded></item><item><title><![CDATA[Checking hbase regions are online.]]></title><description><![CDATA[<p>At $work we have a client with a hadoop cluster, they wanted a nagios check that would check that all of the regions for a specified table were online/queryable. After some research it seemed like the best way was to use <a href="http://wiki.apache.org/hadoop/Hbase/Stargate">stargate</a> which is the REST api for hbase.</p>]]></description><link>https://blog.ab5w.com/checking-hbase-regions-are-online/</link><guid isPermaLink="false">5d1cd567d532dd290a1beed3</guid><category><![CDATA[work]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Tue, 27 Oct 2015 16:11:00 GMT</pubDate><content:encoded><![CDATA[<p>At $work we have a client with a hadoop cluster, they wanted a nagios check that would check that all of the regions for a specified table were online/queryable. After some research it seemed like the best way was to use <a href="http://wiki.apache.org/hadoop/Hbase/Stargate">stargate</a> which is the REST api for hbase.</p><p>The way the check works is that it gets a list of all the regions in the table and then the start/end key, the name, and the location of each region. It then queries the API with '$table . "/" . $key' to see if it returns a result, if it doesn't it adds to to an array for nagios. Once it has finished checking all the regions the script looks at the nagios array, if it's not empty it will echo out all the missing regions and exit 2 (Critical). Else it will say everything is OK and exit with 0.</p><p>As the check takes a while to run for the table being checked the script uses file locking to ensure it only runs one at a time. If nagios tries to run it while it's running it will return message saying it's already running and exit 0.</p><p>The full script is:</p><script src="https://gist.github.com/ab5w/71247872c09fd9f164a1.js"></script>]]></content:encoded></item><item><title><![CDATA[Running puppet with cron]]></title><description><![CDATA[<p>As an update to the previous <a href="http://adventuresindevops.co.uk/puppet-runs-syncing-up/">post</a> I'm glad to say that our puppet setup is working pretty well! The only issue I've had is that the cron generation script we were using started to break crontab on servers. This seems to be due to it creating blank entries when</p>]]></description><link>https://blog.ab5w.com/running-puppet-with-cron/</link><guid isPermaLink="false">5d1cd4fcd532dd290a1beed0</guid><category><![CDATA[work]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Fri, 23 Oct 2015 16:09:00 GMT</pubDate><content:encoded><![CDATA[<p>As an update to the previous <a href="http://adventuresindevops.co.uk/puppet-runs-syncing-up/">post</a> I'm glad to say that our puppet setup is working pretty well! The only issue I've had is that the cron generation script we were using started to break crontab on servers. This seems to be due to it creating blank entries when generating the cron times for a FQDN, which wasn't super awesome.. I decided to look into using the <a href="https://docs.puppetlabs.com/references/latest/function.html#fqdnrand">fqdn_rand()</a> function that is built into puppet to generate random cron timings based on the FQDN of the server. The new cron class looks like:</p><script src="https://gist.github.com/ab5w/8162313b266828034252.js"></script><p>I was worried that it wouldn't balance the load as well as the generation script, but it appears to do it perfectly fine. The network graphs for the puppet masters are nice and steady, no spikes!</p><figure class="kg-image-card"><img src="http://i.imgur.com/pFFeaFX.png" class="kg-image"></figure>]]></content:encoded></item><item><title><![CDATA[Puppet runs 'syncing' up.]]></title><description><![CDATA[<p>So.. Recently we have had a weird issue at $work with puppet where the puppet runs on quite a lot of servers have appeared to all bunch up and run at the same time. Like this video, but instead of metronomes you have ~1800 servers that were once staggered all</p>]]></description><link>https://blog.ab5w.com/puppet-runs-syncing-up/</link><guid isPermaLink="false">5d1cd46fd532dd290a1beecd</guid><category><![CDATA[work]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Tue, 09 Jun 2015 16:07:00 GMT</pubDate><content:encoded><![CDATA[<p>So.. Recently we have had a weird issue at $work with puppet where the puppet runs on quite a lot of servers have appeared to all bunch up and run at the same time. Like this video, but instead of metronomes you have ~1800 servers that were once staggered all deciding to request their catalogs from the <a href="http://adventuresindevops.co.uk/adventures-with-loadbalanced-multimaster-puppet/">puppetmasters</a> at once.</p><center><iframe width="420" height="315" src="https://www.youtube.com/embed/W1TMZASCR-I" frameborder="0" allowfullscreen></iframe></center><p>This can been be seen in the network graph for one of the puppetmasters.</p><figure class="kg-image-card"><img src="http://i.imgur.com/GPObK3K.png" class="kg-image"></figure><p>Every 30 minutes you have around 900 servers (half the load) requesting its catalog. That many servers requesting at once made for very unhappy masters, and the clients were getting 503s for high load. So we had servers failing runs (which is never awesome).</p><figure class="kg-image-card"><img src="http://i.imgur.com/4nDcYR2h.png" class="kg-image"></figure><p>Despite puppet being used by lots of large enterprises, I couldn't find many writeups about dealing with your puppet agents bunching together and how to restagger them, the majority of posts seem to be related to scaling the masters.</p><p>However I did stumble across this handy post from 2012 about staggering the puppet runs with cron - <a href="http://www.krzywanski.net/archives/968">http://www.krzywanski.net/archives/968</a></p><p>I decided to give it a whirl and after updating the script to work with the new CA command I have to say it seems to be working pretty fabulously, though the fix has only been implemented for a few hours so far.</p><p>You can see the different in network usage after all the agents were changed to cron.</p><figure class="kg-image-card"><img src="http://i.imgur.com/e2C7GFD.png" class="kg-image"></figure><p>And in the 48 hour graph you can see that the load is much more balanced now.</p><figure class="kg-image-card"><img src="http://i.imgur.com/yX8Zzif.png" class="kg-image"></figure><p>After adding the scripts from the previous link to the masters (with puppet of course!), I created the following mini class to apply the changes to the agents:</p><script src="https://gist.github.com/ab5w/f826c7648e82eb7f1191.js"></script><p>After testing this was added to the top level class for all our nodes, and it rolled out without any major issues. The only issue I encountered was due to facter returning nil for $::fqdn if the node didn't have a domain set as well as a hostname. This was fixed by editing the fqdn.rb on the node to return the hostname instead of nil, rather hacky.. but it works without needing to change the hostname of a server in production! (This issue appears to be fixed in the later version of facter)</p><p><strong>Future plans/ideas/thoughts:</strong></p><p>Look at random cron timings with <a href="https://docs.puppetlabs.com/references/latest/function.html#fqdnrand">fqdn_rand()</a> at somepoint instead of the node list script, as the number of nodes managed by puppet increases steadily each week and the list is currently regenerated everytime a node is added.</p><p>Even though the load has been balanced the masters do still sit with a small amount of load, so adding another master to the haproxy pool would help a lot.</p>]]></content:encoded></item><item><title><![CDATA[Adventures with loadbalanced multimaster puppet.]]></title><description><![CDATA[<p>At $work we use glorious puppet for our configuration management needs. The first version of our puppetmaster was a xen virtual machine with 2 cores, 8GB RAM and 60GB diskspace. This was fine for a while. However soon it started struggling under the load as the amount of servers managed</p>]]></description><link>https://blog.ab5w.com/adventures-with-loadbalanced-multimaster-puppet/</link><guid isPermaLink="false">5d1cd3e7d532dd290a1beeca</guid><category><![CDATA[work]]></category><dc:creator><![CDATA[Craig Parker]]></dc:creator><pubDate>Sat, 11 Apr 2015 16:05:00 GMT</pubDate><content:encoded><![CDATA[<p>At $work we use glorious puppet for our configuration management needs. The first version of our puppetmaster was a xen virtual machine with 2 cores, 8GB RAM and 60GB diskspace. This was fine for a while. However soon it started struggling under the load as the amount of servers managed increased, so the puppetmaster was upgraded to a Dell R320 with 12 cores, 32GB RAM and two 240GB SSDs in RAID1.</p><p>We also started using puppetdb for fact collection (and foreman for reporting, but that is on another server). This setup worked fine for just over a year (system_birth =&gt; Thu Jan 23 13:15:23 2014), but again it started struggling under the load of managed hosts (well over 2000 currently and increasing at a steady rate). The load would spike and we would get batches of failed runs due to timeouts.</p><p>A plan was made to investigate and setup a loadbalaced multimaster environment for better load management. Two Dell R630's with 32 cores, 128GB RAM and 2x480GB SSDs in RAID1 were provisioned. Plenty of performance for our puppets. The plan was to setup a dedicated haproxy box for the loadbalancer and to use puppet to update the server setting on each node to point to this as the master to use.</p><p>However that's not what happened, instead we had what I will affectionately call "puppet failure friday". I'm not entirely sure what happened, since I was asleep at the time.. but it looks like the server swapped, apache hit max clients and then couldn't keep up with the resulting load which climbed rapidly and resulted in puppet agents failing runs due to timeouts or runs stagnating. This is shown in the below diagram.</p><p></p><figure class="kg-image-card"><img src="http://i.imgur.com/u38hDrTl.jpg" class="kg-image"></figure><p>This therefore meant the multimaster plan was expedited somewhat, as I couldn't get the current master to handle the load at all. Having your puppet master sit at a load average of 200 isn't particularly great for having it do anything useful!</p><p>As I couldn't use puppet to set the server on each agent to a new one, I used the existing puppetmaster as the load balancer. We run puppet under apache so I changed the vhost on the existing master to listen on 8150 instead of 8140, haproxy now listens on 8140. The new masters were setup as per the puppetlabs documentation (which is generally awesome, as documentation goes), with <a href="https://docs.puppetlabs.com/guides/scaling_multiple_masters.html#before-running-puppet-agent-or-puppet-master">alt_dns_names</a> configured.</p><p>My haproxy config is:</p><script src="https://gist.github.com/ab5w/5870d91ab6e0569b13f7.js"></script><p>The newer servers have a higher weight than the existing master, as they are way more awesome in terms of specs. The existing master also runs puppetdb.</p><p>The haproxy stats looks like:</p><figure class="kg-image-card"><img src="http://i.imgur.com/2IMx7sil.png" class="kg-image"></figure><p>The existing master is also the ca master, so the other masters are set to forward any certificate requests to it (on port 8150).</p><script src="https://gist.github.com/ab5w/dcbb125f673f463ffc95.js"></script><p>The new masters have also been configured to talk to puppetdb and send reports to theforeman. As we use svn for our manifests and modules, there is currently a cron to rsync changes to the two other masters when the existing master is updated. They will be set to do a svn up everytime their puppet agent runs (like the existing master) and added to our chatops ability to run svn up (modules|manifests) on the master(s) from our internal chatserver.</p><p>The setup is handling the current load very well (as one would hope!) and manages fine if you remove a server from the haproxy pool. The only issue is that if you restart httpd on any of the servers (or haproxy itself) you get a handful of servers failing runs due to timouts in the ~10 seconds it takes it to restart!</p><p>Future plans: Add another server to the pool to take over the master duties of the existing master (leaving it to just do puppetdb/ca). Possibly move haproxy to it's own server, though that would be another adventure.</p>]]></content:encoded></item></channel></rss>