Skip to content

Instantly share code, notes, and snippets.

@amarao
Created December 10, 2013 17:53
Show Gist options
  • Save amarao/7895003 to your computer and use it in GitHub Desktop.
Save amarao/7895003 to your computer and use it in GitHub Desktop.
#!/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