Nagios check_load over check_by_ssh for multi-core processors

Nick Doyle
1 min readJul 24, 2018

--

Originally published 29th July, 2011

I found the default “check_load” lacking, in that I was interested not in total load, but total load as a percentage of processors available; a load of 4 on a single core is bad, on dual quad-core is fine. And you could argue that I shouldn’t be lazy, and should supply custom loads based on #cores for all monitored servers, to which I would reply that I am very lazy. So, wrote this script which checks load, with thresholds as fractions of total load available.

i.e. a threshold of “5” means 500% load, “0.5” 50% and so on.

The main ideas are:

  • get # cores with “grep processor /proc/cpuinfo | wc -l”
  • divide input load tolerances by number of cores, to find tolerances on same scale as given by “uptime”

So here goes. I’ve only been learning Python recently so might not be super-nice, but works for me. Input very welcome. To install:

  • put this code in remote monitored server, in ~nagios/IA32 (or whichever you’re using) as file “check_load_percentage”
    (adjusting defaults to suit you)
  • in ~nagios/nagios_check.sh
    #default loads (unless … you want to use them ..)
    add case for “load_percentage”
  • on nagios server, define service with check_command = check_by_ssh!load_percentage

Here’s the code on pastebin

--

--

Nick Doyle
Nick Doyle

Written by Nick Doyle

Cloud-Security-Agile, in Melbourne Australia, experience includes writing profanity-laced Perl, surprise Migrations, furious DB Admin and Motorcycle instructing

No responses yet