Skip to main content

A check to monitor puppet agent runs

Project description

wywygmbh/check-puppet-agent

A small script with few dependencies to check the status of puppet agent runs

It is tested as a sensu check plugin, but also compatible with nagios/icinga/… due to the similar exit codes

Installation

dependencies

The requirements are just:

  • argparse (command line argument parsing)

  • yaml (to read the puppet state files)

  • six (python 2 and 3 compatibility)

pip

The package is easily available on pypi and can be just installed with pip, this also includes the command line script

$ pip install check-puppet-agent

RPM

Currently there are no prebuilt RPM packages provided, but you can built them by yourself with some simple commands

$ git clone … $ cd check-puppet-agent $ python setup.py bdist_rpm

Usage

Note: The script is to run as puppet user or root, otherwise it is not able to read the required files

$ check-puppet-agent
[CRITICAL] applying catalog compiled at 2015-12-06 21:50:21 (1 days 20 hours 3 minutes 23 seconds ago)
[      OK] last run on 2015-12-08 17:36:19 (17 minutes 25 seconds ago)
[      OK] => last run took 11 seconds

Sample if the agent is disabled by puppet agent --disable "test"

$ check-puppet-agent
[ WARNING] puppet agent is disabled - reason: test
[CRITICAL] applying catalog compiled at 2015-12-06 21:50:21 (1 days 20 hours 4 minutes 53 seconds ago)
[      OK] last run on 2015-12-08 17:36:19 (18 minutes 55 seconds ago)
[      OK] => last run took 11 seconds

Options

$ check-puppet-agent --help
usage: check_puppet [-h] [--warning-run-age WARNING_RUN_AGE]
                    [--critical-run-age CRITICAL_RUN_AGE]
                    [--warning-catalog-age WARNING_CATALOG_AGE]
                    [--critical-catalog-age CRITICAL_CATALOG_AGE]
                    [--warning-run-duration WARNING_RUN_DURATION]
                    [--critical-run-duration CRITICAL_RUN_DURATION]
                    [--filename FILENAME]
                    [--disabled-lock-file DISABLED_LOCK_FILE]
                    [--run-lock-file RUN_LOCK_FILE]

optional arguments:
  -h, --help            show this help message and exit
  --warning-run-age WARNING_RUN_AGE
                        warn at age of last puppet run in seconds (default:
                        1h5m) => 0s to disable
  --critical-run-age CRITICAL_RUN_AGE
                        critical at age of last puppet run in seconds
                        (default: 2h10m) => 0s to disable
  --warning-catalog-age WARNING_CATALOG_AGE
                        warn at catalog age in seconds (default: 1h5m) => 0s
                        to disable
  --critical-catalog-age CRITICAL_CATALOG_AGE
                        critical at catalog age in seconds (default: 2h10m) =>
                        0s to disable
  --warning-run-duration WARNING_RUN_DURATION
                        warn at puppet run duration in seconds (default: 20m)
                        => 0s to disable
  --critical-run-duration CRITICAL_RUN_DURATION
                        critical at puppet run duration in seconds (default:
                        30m) => 0s to disable
  --filename FILENAME   the puppet state file to parse
  --disabled-lock-file DISABLED_LOCK_FILE
                        the path to the lock file if the agent is disabled
  --run-lock-file RUN_LOCK_FILE
                        the path to the lock file if the agent is running

License

Copyright 2015 wywy GmbH

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

This script is proudly presented by the DevOps guys at wywy GmbH.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

check-puppet-agent-1.0.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distributions

check_puppet_agent-1.0.0-py3.5.egg (10.0 kB view details)

Uploaded Egg

check_puppet_agent-1.0.0-py2.py3-none-any.whl (9.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file check-puppet-agent-1.0.0.tar.gz.

File metadata

File hashes

Hashes for check-puppet-agent-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f940cc6da2f2881433ba2d10ef0fa559ea5e1e123828a71b9f920d47ece8eeac
MD5 09f40066c7356d5ffcdbb6b4eb6a559d
BLAKE2b-256 6892c22278b182f036c6fddb56765dc55928f7e2cdea549275e32476e5a70509

See more details on using hashes here.

File details

Details for the file check_puppet_agent-1.0.0-py3.5.egg.

File metadata

File hashes

Hashes for check_puppet_agent-1.0.0-py3.5.egg
Algorithm Hash digest
SHA256 1a92b0087612a16647b0308c238f7d69685ff280f57ffc59fe212aaa6015a203
MD5 7e187b61cb74631b672662b4a6c723d5
BLAKE2b-256 5179968a2739b036512f52273169f4317556a2d31b59af336ea33d38dfc5149d

See more details on using hashes here.

File details

Details for the file check_puppet_agent-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for check_puppet_agent-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6c4336414bc043737ad700fc44ff14605dad2b2528ba9ff17641ac08ccc25eb7
MD5 d7171fd5f345c77767e54ca7b2788050
BLAKE2b-256 421d851d318244c4b7ad817bf1bdafa15e409fbcec58abbfdc580755157f92d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page