Created
September 14, 2015 09:08
-
-
Save elleryq/bdbba497b5314456dd98 to your computer and use it in GitHub Desktop.
check_load command generator
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 | |
| # check_load is provied by nagios-plugins-basic | |
| # The formula origin: | |
| # * http://serverfault.com/questions/209566/what-warning-and-critical-values-to-use-for-check-load | |
| import os | |
| import sys | |
| import multiprocessing | |
| def main(): | |
| cpu_count = multiprocessing.cpu_count() | |
| # warnings | |
| warnings = { | |
| "the_1_min_load_avg": cpu_count*8, | |
| "the_5_min_load_avg": cpu_count*5, | |
| "the_15_min_load_avg": cpu_count*2 | |
| } | |
| # criticals | |
| criticals = { | |
| "the_1_min_load_avg": cpu_count*10, | |
| "the_5_min_load_avg": cpu_count*8, | |
| "the_15_min_load_avg": cpu_count*3 | |
| } | |
| print(" ".join( | |
| ["/usr/lib/nagios/plugins/check_load", | |
| "-w {the_1_min_load_avg},{the_5_min_load_avg},{the_15_min_load_avg}".format( | |
| **warnings), | |
| "-c {the_1_min_load_avg},{the_5_min_load_avg},{the_15_min_load_avg}".format( | |
| **criticals)])) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment