Monitoring Alternative PHP Cache (APC) Using Cacti Graphs

Cacti Logo

Despite Zend’s OPcache being available in PHP 5.5, a lot of people – myself included – still use the tried and tested Alternative PHP Cache (APC) on older versions of PHP. Although APC tries its best to have a ‘set it and forget it’ approach with very sensible and effective defaults, if you want to get the best performance out of it then you should consider monitoring the status of the cache.

I use Cacti almost exclusively on my linux machines to monitor the status of various system processes. Despite usually having no problem finding scripts to monitor just about everything, I’ve been relatively disappointed in the availability of APC monitoring scripts for Cacti so I’ve created my own. Only requirements are wget on the server hosting Cacti (you likely already have this) and the ability for said server to access a webpage on the PHP server being monitored. (more…)

Downloading Programmes From 4od – Linux

There used to be an official application created by Channel 4 which allowed you to download from their on-demand service, 4od, but this has since been discontinued and is no longer available. This sucks if you don’t have a stable or quick internet connection, because it means that you have to put up with buffering and low quality streams available. It’s understandable as to why it’s no longer available; Channel 4 is not like the BBC which is uniquely funded by the TV license, but rather relies on advertising to generate revenue. Download programmes and watching them outside of the 4od framework obviously denies them this revenue source, so please consider this solution only if streaming shows from the 4od channel on YouTube or via the 4od website is unreasonable.

Rob Watkins has created a Ruby script which allows you to download 4od programmes from the website and play them back in a local media player. He has made it publicly available on GitHub with instructions on how to use it on OS X. Here’s how to get it running on Linux.

(more…)

Wrong partition sizes after cloning

I’ve just finished migrating multiple partitions from a series of old hard drives onto brand new 2TB disks. I created the new partitions on my new HDDs and then used dd, or more specifically ddrescue, to copy the partition data over. When I booted into Windows though, the partitions were still showing as being their old sizes from when they were on the old HDDs. I made the (wrong) assumption that Windows would automatically correct it when it detected there was a discrepancy between the partition table and the indications within the partition.

I tried chkdsk and chkntfs to run and schedule Windows’ disk checker, but this found nothing of any particular interest and didn’t fix my problem. The solution I found was to use a tool like parted (or gparted) and shrink the partitions down by some arbitrary value (1MB in my case) , reboot, and run chkdsk again. This will hopefully change the size of the partition to be correct in Windows. Note that the disk management in Windows doesn’t seem to like to shrink the drives and fired back an error whenever I attempted it; I had to boot into gparted to resize them.

As they were only partitions I had used for archived files and such, I think a better solution in future would be to copy the files over, retaining permissions etc., rather than copy the raw data from the partition directly.