Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix thresholds #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ If you are using the socket URL to access the API, on each monitored host, you'l

Service is running:

DOCKER OK | events_listeners=0 file_descriptors=10 go_routines=12 images=11 service=0;0;0
DOCKER OK | events_listeners=0 file_descriptors=20 go_routines=33 images=0 service=1;1:1;1:1

Service is not running:

DOCKER CRITICAL - (outside range 0:0) | service=1;0;0
DOCKER CRITICAL - outside range 1:1 | service=0;1:1;1:1

Mind you that the latter is also returned when the user running this plugin lacks sufficient privileges to run `docker info`.

The following stats are returned:

Expand Down Expand Up @@ -97,6 +99,3 @@ To install this you can run:
### User Interface

![image](screenshot.png)



8 changes: 4 additions & 4 deletions check_docker
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Docker(nagiosplugin.Resource):

metrics = [
nagiosplugin.Metric(
'service', self.docker_running),
'service', int(self.docker_running)),
nagiosplugin.Metric('images', self.images, context='default'),
nagiosplugin.Metric(
'go_routines', self.go_routines, context='default'),
Expand All @@ -55,7 +55,7 @@ class Docker(nagiosplugin.Resource):
]

else:
metrics = [nagiosplugin.Metric('service', self.docker_running)]
metrics = [nagiosplugin.Metric('service', int(self.docker_running))]

return metrics

Expand Down Expand Up @@ -85,9 +85,9 @@ def main():

args = argp.parse_args()

# create our check object, if service metric !=0, consider that critical.
# create our check object, if service metric !=1 (True), consider that critical.
check = nagiosplugin.Check(Docker(args.url, args.api_version),
nagiosplugin.ScalarContext('service', '0', '0', fmt_metric=''),
nagiosplugin.ScalarContext('service', '1:1', '1:1', fmt_metric=''),
DockerSummary())

check.main(args.verbose, args.timeout)
Expand Down