JSON Parsing Nagios Script

Reading Time: 2 minutes

Parsing JSON in Bash is never usually the best idea but sometimes it may be necessary or preferred. Here’s a nice easy script which uses the ‘jq’ command to perform JSON parsing in Bash.

imgres

Let’s imagine you have the following JSON which is outputted by a stats gathering process:

{"web_rate":1,"db_rate":2,"php_rate":2}

Parsing that in Bash by writing some regex’s etc is perfecting possible but there’s an infinitely easier way. Welcome to ‘jq’. Let’s see it in action.

Read More »

Useful to know Bash parameters

Reading Time: 3 minutes

Even having¬†written many hundreds of Bash scripts over the years I sometimes forget the basic special parameters which are available. For that reason I’ve made this post which is a copy of the page from gnu.org.

bash-logo-web

Read More »

Prevent apcupsd shutting down the OS

Reading Time: 1

If you have an APC UPS you may not, for whatever reason, want the OS to trigger a shutdown. The ‘apcupsd’ package will call shutdown whenever the battery capacity is reported too low. To prevent this, just edit the following file.

8c516a38-5056-ae36-fe9e72b8749700c8_pr

Read More »

How to download iplayer content on Linux

Reading Time: 16 minutes

Here is a very simple way to download iPlayer content using a Linux command line tool. This literally downloads the stream and saves it to a file.¬†The best part is, because they’re not DRM protected, you can keep it forever.

bbc-iplayer-logo

Continue reading

How to resize a VirtualBox disk

Reading Time: 1

Very quick post on how to resize a VirtualBox virtual disk.

virtualbox

 

When using QCOW based disks with Virtual Box there’s no automagic method for resizing the disks. Because of that you first have to convert it. Here’s the commands you need…

Read More »