Created
March 13, 2013 12:21
-
-
Save pixie79/5151597 to your computer and use it in GitHub Desktop.
Trigger for working our cpu alert levels needed for sensu or nagios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# CPU Alert levels - based on number of CPU in machine | |
from __future__ import division | |
import multiprocessing | |
cpu = multiprocessing.cpu_count() | |
if cpu <= 2: | |
cpu = 3 | |
# Warnings | |
w1cpu = ((cpu / 100) * 150) | |
w10cpu = ((cpu / 100) * 120) | |
w15cpu = ((cpu / 100) * 110) | |
# Critical | |
c1cpu = ((cpu / 100) * 200) | |
c10cpu = ((cpu / 100) * 150) | |
c15cpu = ((cpu / 100) * 120) | |
print "-w %s,%s,%s" % (w1cpu, w10cpu, w15cpu), | |
print "-c %s,%s,%s" % (c1cpu, c10cpu, c15cpu), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment