Created
December 10, 2013 17:53
-
-
Save amarao/7895003 to your computer and use it in GitHub Desktop.
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/python | |
import nagiosplugin | |
class Mycheck(nagiosplugin.Resource): | |
def __init__(self, url): | |
self.check_operations=["check1", "check2", "check3"] | |
self.url=url | |
def perform_check(self,check_type): | |
''' | |
< 555 - ok | |
[555-666) - warning | |
>=666 - critical | |
''' | |
return 444 | |
def probe(self): | |
for check in self.check_operations: | |
yield nagiosplugin.Metric(check , self.perform_check(check), context="my_check_context") | |
check = nagiosplugin.Check( | |
Mycheck('http://example.com'), | |
nagiosplugin.ScalarContext('my_check_context', '555', '666')) | |
check.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment