Plugin Nagios écrit en Python

Simple exemple

#!/usr/bin/env python

import os,sys

(d1, d2, d3) = os.getloadavg()

if d1 >= 5.0:
    print "GETLOADAVG CRITICAL: Load average is %.2f" % (d1)
    sys.exit(2)
elif d1 >= 2.0:
    print "GETLOADAVG WARNING: Load average is %.2f" % (d1)
    sys.exit(1)
else:
    print "GETLOADAVG OK: Load average is %.2f" % (d1)
    sys.exit(0)

Exemple complet

#!/usr/bin/env python

import os
import sys
import getopt

def usage():
    print """Usage: check_getloadavg [-h|--help] [-m|--mode 1|2|3] \
    [-w|--warning level] [-c|--critical level]"

Mode: 1 - last minute ; 2 - last 5 minutes ; 3 - last 15 minutes"
Warning level defaults to 2.0
Critical level defaults to 5.0"""
    sys.exit(3)

try:
    options, args = getopt.getopt(sys.argv[1:],
        "hm:w:c:",
        "--help --mode= --warning= --critical=",
        )
except getopt.GetoptError:
    usage()
    sys.exit(3)

argMode = "1"
argWarning = 2.0
argCritical = 5.0

for name, value in options:
    if name in ("-h", "--help"):
        usage()
    if name in ("-m", "--mode"):
        if value not in ("1", "2", "3"):
            usage()
        argMode = value
    if name in ("-w", "--warning"):
        try:
            argWarning = 0.0 + value
        except Exception:
            print "Unable to convert to floating point value\n"
            usage()
    if name in ("-c", "--critical"):
        try:
            argCritical = 0.0 + value
        except Exception:
            print "Unable to convert to floating point value\n"
            usage()

try:
    (d1, d2, d3) = os.getloadavg()
except Exception:
    print "GETLOADAVG UNKNOWN: Error while getting load average"
    sys.exit(3)

if argMode == "1":
    d = d1
elif argMode == "2":
    d = d2
elif argMode == "3":
    d = d3

if d >= argCritical:
    print "GETLOADAVG CRITICAL: Load average is %.2f" % (d)
    sys.exit(2)
elif d >= argWarning:
    print "GETLOADAVG WARNING: Load average is %.2f" % (d)
    sys.exit(1)
else:
    print "GETLOADAVG OK: Load average is %.2f" % (d)
    sys.exit(0)

World company unlimited

Green fireworks of 91
You were told it was about oil,
Now there's a war in Europa
And plenty more in the cupboard,
No derricks on this land
And you don't understand


Seems like Groucho's Freedonia
Is alive in nearby Slavia
When this silly duck walking
Turns into goose stepping


You've never learned from History
Here comes more insanity,
Two maffias have merged, have merged
in the World Company Unlimited
Never learn from History


Demagogues came into power
And friendly human beings,
I'd better say puppets on strings
Become ruthless murderers


War is still the best way
Of dictating submission
And also the drastic solution
Not to pay you on the dole,
The more destructions you get
The more they will invest


You've never learned from History
Here comes more insanity,
Two maffias have merged, have merged
in the World Company Unlimited

Par The Informers @ Mondopoly

El Sub at the controls

Voiceless, hopeless
We had no past,
We got to bow
Just like tomorrow,
Less than tools and rats
More like stone and grass


El sub at the controls
Calls on new solutions
El sub at the controls
Calls for revolution,
El sub at the controls
Here comes revolution


Mountains told us
To hide our red face,
Rivers whispered
- curb Authority -,
Winds kept telling us
To use wile and guns


El sub at the controls
Calls on new solutions
El sub at the controls
Calls for revolution,
El sub at the controls
Here comes revolution


We’re neither soldiers
Nor politicians,
We’d rather be dancers
And street musicians,
Let’s party on the market place
Let’s forget the place of the Market

Par The Informers @ Mondopoly

Chain gang

Marqué :

hooh! aah! hooh!
I hear somethin' sayin'


hooh! aah!
hooh! aah!
hooh! aah!
hooh! aah!


Well, don't you know
That's the sound of the men working on the chain ga-a-ang
That's the sound of the men working on the chain gang


All day long they're singin'
hooh! aah!
hooh! aah!
hooh! aah!
hooh! aah!


Well, don't you know
That's the sound of the men working on the chain ga-a-ang
That's the sound of the men working on the chain gang


All day long they work so hard
Till the sun is goin' down
Working on the highways and byways
And wearing, wearing a frown
You hear them moanin' their lives away
Then you hear somebody sa-ay


That's the sound of the men working on the chain ga-a-ang
That's the sound of the men working on the chain gang


Can't ya hear them singin'
Mm, I'm goin' home one of these days
I'm goin' home see my woman
Whom I love so dear
But meanwhile I got to work right he-ere


Well, don't you know
That's the sound of the men working on the chain ga-a-ang
That's the sound of the men working on the chain gang


All day long they're singin', mm
My, my, my, my, my, my, my, my, my work is so hard
Give me water, I'm thirsty


My work is so hard

Par Sam Cooke @ Swing Low

Call center girl

Lucy has joined a call center
Dreaming of a bright future,
She'll just need an atomic smile
And to pretend being servile,


This is the new economy
Cool jobs and easy money
This is the new economy


Same old pain and misery !


Everyday's a competition
She'd better be the champion,
When she keeps the highest score
Her photo's pinned on the wall,


Another clone of Stakhanov
Joe Stalin is back in obs
Another clone of Stakhanov


Same old pain and misery !


She read it in a magazine :
"Be lazy - just call us"
But if she dares to take a break
Her phone will raise a red alert,


"You will rest when you are dead"
Goes one of the firm adverts
"You will rest when you are dead"


Same old pain and misery !


It only took a few weeks
Before she learned the tricks,
There's nothing like a sick pay
To make her day, make her day,


This is the new economy
Tedious jobs and poor money


Old and new economy
Same old pain and misery

Par The Informers @ Mondopoly