puppet_status_check
Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x
- Puppet >= 7.10.0 < 9.0.0
- , , , , , , , , ,
Plans:
- summary
Start using this module
Add this module to your Puppetfile:
mod 'puppetlabs-puppet_status_check', '0.9.3'Learn more about managing modules with a PuppetfileDocumentation
Puppet Status Check
- Description
- Setup
- Usage
- Reporting Options
- Reference
- How to report an issue or contribute to the module
Description
Puppet Status Check provides a way to alert the end-user when Puppet is not in an ideal state. It uses pre-set indicators and has a simplified output that directs the end-user to the next steps for resolution.
Setup
What this module affects
This module primarily provides status indicators the fact named puppet_status_check. Once nodes have been classified with the module, facts will be generated and the optional indicators can occur. By default, fact collection is set to only check the status of the Puppet agent. Puppet infrastructure checks require additional configuration.
Setup requirements
Install the module, plug-in sync will be used to deliver the required facts for this module, to each agent node in the environment the module is installed in.
Usage
Classify nodes with puppet_status_check. Notify resources will be added to a node on each Puppet run if indicator's are reporting as false. These can be viewed in the Puppet report for each node, or queried from Puppetdb.
Enable infrastructure checks
The default fact population will not perform checks related to puppet infrastructure services such as the puppetserver, puppetdb, or postgresql. To enable the checks for Puppet servers, set the following parameter to those infrastructure node(s):
puppet_status_check::role: primary
Optionally define the path to pg_config if it is not in the standard path.
puppet_status_check::pg_config_path: /usr/pgsql-16/bin/pg_config
Disable
To completely disable the collection of puppet_status_check facts, uninstall the module or classify the module with the enabled parameter:
puppet_status_check::enabled: false
Reporting Options
Class declaration
To enable fact collection and configure notifications, classify nodes with the puppet_status_check class. Examples using site.pp:
- Check basic agent status:
node 'node.example.com' { include 'puppet_status_check' } - Check puppet server infrastructure status:
node 'node.example.com' { class { 'puppet_status_check': role => 'primary', } } - For maximum coverage, report on all default indicators. However, if you need to make exceptions for your environment, classify the array parameter
indicator_exclusionswith a list of all the indicators you do not want to report on.class { 'puppet_status_check': indicator_exclusions => ['S0001','S0003','S0003','S0004'], }
Using a Puppetdb query to report status.
As the module uses Puppet's existing fact behavior to gather the status data from each of the agents, it is possible to use PQL (puppet query language) to gather this information.
Consult with your local Puppet administrator to construct a query suited to your organizational needs. Please find some examples of using the puppetdb_cli gem to query the status check facts below:
- To find the complete output from all nodes listed by certname (this could be a large query based on the number of agent nodes, further filtering is advised ):
puppet query 'facts[certname,value] { name = "puppet_status_check" }' - To find the complete output from all nodes listed by certname with the
primaryrole:puppet query 'facts[certname,value] { name = "puppet_status_check" and certname in facts[certname] { name = "puppet_status_check_role" and value = "primary" } }' - To find those nodes with a specific status check set to false:
puppet query 'inventory[certname] { facts.puppet_status_check.S0001 = false }'
Ad-hoc Report (Plans)
The plan puppet_status_check::summary summarizes the status of each of the checks on target nodes that have the puppet_status_check fact enabled. Sample output can be seen below:
TBC
Setup Requirements
Hiera is utilized to lookup test definitions, this requires placing a static hierarchy in your environment level hiera.yaml.
plan_hierarchy:
- name: "Static data"
path: "static.yaml"
data_hash: yaml_data
Refer to the bolt hiera documentation for further explanation.
Using Static Hiera data to populate indicator_exclusions when executing plans
Place the plan_hierarchy listed in the step above, in the environment layer.
Create a [static.yaml] file in the environment layer hiera data directory
puppet_status_check::indicator_exclusions:
- '<TEST ID>'
Indicator ID's within array will be excluded when running the puppet_status_check::summary plan.
Running the plans
The puppet_status_check::summary plans can be run from the Puppet Bolt. More information on parameters of the plan can be viewed in [REFERENCE.md].
- Example call from the command line to run
puppet_status_check::summaryagainst all infrastructure nodes:bolt plan run puppet_status_check::summary role=primary - Example call from the command line to run
puppet_status_check::summaryagainst all regular agent nodes:bolt plan run puppet_status_check:summary role=agent - Example call from the command line to run against a set of infrastructure nodes:
bolt plan run puppet_status_check::summary targets=server-70aefa-0.region-a.domain.com,psql-70aefa-0.region-a.domain.com - Example call from the command line to exclude indicators for
puppet_status_check::infra_summary:bolt plan run puppet_status_check::summary -p '{"indicator_exclusions": ["S0001","S0021"]}' - Example call from the command line to exclude indicators for
puppet_status_check::agent_summary:bolt plan run puppet_status_check::summary -p '{"indicator_exclusions": ["AS001"]}'
Reference
Facts
puppet_status_check_role
This fact is used to determine which status checks are included on an infrastructure node. Classify the puppet_status_check module with a role parameter to change the role.
| Role | Description |
|---|---|
| primary | The node hosts a puppetserver, puppetdb, database, and certificate authority |
| compiler | The node hosts a puppetserver and puppetdb |
| postgres | The node hosts a database |
| agent | The node runs a puppet agent service |
The role is agent by default.
puppet_status_check
This fact is confined to run on infrastructure nodes only.
Refer to the table below for next steps when any indicator reports a false.
As this module was derived from the Puppet Enterprise status check module, links within the Self-service steps below may reference Puppet Enterprise specific solutions. The goal over time is to eventually update these to include Open Source Puppet as well.
| Indicator ID | Description | Self-service steps |
|---|---|---|
| S0001 | The puppet service is running on agents | See documentation |
| S0003 | Infrastructure components are running in noop | Do not routinely configure noop on infrastructure nodes, as it prevents the management of key infrastructure settings. Disable this setting on infrastructure components. |
| S0004 | Puppet Server status endpoint is returning any errors | Execute puppet infrastructure status. Which ever service returns in a state that is not running, examine the logging for that service to indicate the fault. |
| S0005 | Certificate authority (CA) cert expires in the next 90 days | Install the puppetlabs-ca_extend module and follow steps to extend the CA cert. |
| S0006 | Puppet metrics collector is enabled and collecting metrics. | Metrics collector is a tool that lets you monitor a installation. If it is not enabled, enable it. |
| S0007 | There is at least 20% disk free on the PostgreSQL data partition | Determines if growth is slow and expected within the TTL of your data. If there's an unexpected increase, use this article to troubleshoot PuppetDB |
| S0008 | There is at least 20% disk free on the codedir data partition | This can indicate you are deploying more code from the code repo than there is space for on the infrastructure components, or that something else is consuming space on this partition. Run puppet config print codedir, check that codedir partition indicated has enough capacity for the code being deployed, and check that no other outside files are consuming this data mount. |
| S0009 | Puppetserver service is running and enabled | Checks that the service can be started and enabled by running puppet resource service pe-puppetserver ensure=running, examines /var/log/puppetlabs/puppetserver/puppetserver.log for failures. |
| S0010 | Puppetdb service is running and enabled | Checks that the service can be started and enabled by running puppet resource service pe-pupeptdb ensure=running, examines /var/log/puppetlabs/puppetdb/puppetdb.log for failures. |
| S0011 | Postgres service is running and enabled | Checks that the service can be started and enabled by running puppet resource service pe-postgres ensure=running, examines /var/log/puppetlabs/postgresql/<postgresversion>/postgresql-<today>.log for failures. |
| S0012 | Puppet produced a report during the last run interval | Troubleshoot Puppet run failures. |
| S0013 | The catalog was successfully applied during the last Puppet run | Troubleshoot Puppet run failures. |
| S0014 | Anything in the command queue is older than a Puppet run interval | This can indicate that the PuppetDB performance is inadequate for incoming requests. Review PuppetDB performance. Use metrics to pinpoint the issue. |
| S0015 | The agent host certificate is expiring in the next 90 days | Puppet Enterprise has built in functionalilty to regenerate infrastructure certificates, see the following documentation |
| S0016 | There are no OutOfMemory errors in the Puppetserver log | Increase the Java heap size for that service. |
| S0017 | There are no OutOfMemory errors in the Puppetdb log | Increase the Java heap size for that service. |
| S0019 | There sufficient jRubies available to serve agents | Insufficient jRuby availability results in queued puppet agents and overall poor system performance. There can be many causes: Insufficient server tuning for load, a thundering herd, and insufficient system resources for scale. |
| S0021 | There is at least 10% free system memory | Ensure your system hardware availability matches the recommended configuration, note this assumes no third-party software using significant resources, adapt requirements accordingly for third-party requirements. Examine metrics from the server and determine if the memory issue is persistent |
| S0023 | Certificate authority CRL does not expire within the next 90 days | The solution is to reissue a new CRL from the Puppet CA, note this will also remove any revoked certificates. To do this follow the instructions in this module |
| S0024 | Files in the puppetdb discard directory more than 1 week old | Recent files indicate PuppetDB may have in issue processing incoming data. See this article for more information. |
| S0025 | The host copy of the CRL does not expire in the next 90 days | If S0023 on the primary role is also false, use the resolution steps in S0023. If S0023 on the primary is true, follow this article |
| S0026 | The puppetserver JVM Heap-Memory is set to an efficient value | Due to an oddity in how JVM memory is utilized, most Java applications are unable to consume heap memory between ~31GB and ~48GB. If the heap memory set within this value, reduce it to efficiently allocate server resources. See this article for more information. |
| S0027 | The puppetdb JVM Heap-Memory is set to an efficient value | Due to an oddity in how JVM memory is utilized, most Java applications are unable to consume heap memory between ~31GB and ~48GB. If the heap memory set within this value, reduce it to efficiently allocate server resources. See this article for more information. |
| S0029 | Postgresql connections are less than 90% of the configured maximum | First determine the need to increase connections, evaluate if this message appears on every puppet run, or if idle connections from recent component restarts may be to blame. If persistent, impact is minimal unless you need to add more components such as Compilers or Replicas, if you plan to increase the number of components on your system, increase the max_connections value. Consider also increasing shared_buffers if that is the case as each connection consumes RAM. |
| S0030 | Puppet is configured with use_cached_catalog set to true |
It is recommended to not enable use_cached_catalog. Enabling prevents the enforcement of key infrastructure settings. See our documentation for more information |
| S0033 | Hiera version 5 is in use | Upgrading to Hiera 5 offers major advantages |
| S0034 | Puppetserver been upgraded within the last year | Upgrade your instance. |
| S0035 | puppet module list is not returning any warnings |
Run puppet module list --debug and resolve the issues shown. The Puppetfile does NOT include Forge module dependency resolution. Ensure that every module needed for all of the specified modules to run is included. Refer to managing environment content with a Puppetfile and refer individual modules on the Puppet forge for dependency information. |
| S0036 | Puppetserver configured max-queued-requests is less than 151 |
The maximum value for jruby_puppet_max_queued_requests is 150 |
| S0038 | Number of environments under $codedir/environments is less than 100 |
Having a large number of code environments can negatively affect Puppet Server performance. See Configuring Puppet Server documentation for more information. Remove any environments that are not required. If all are required you can ignore this warning. |
| S0039 | Puppetserver has not reached the configured queue-limit-hit-rate |
See the max-queued-requests article for more information. |
| S0045 | Puppetserver is configured with a reasonable number of JRubies | Having too many can reduce the amount of heap space available to puppetserver and cause excessive garbage collections, reducing performance. While it is possible to increase the heap along with the number of JRubies, we have observed diminishing returns with more than 12 JRubies. Therefore an upper limit of 12 is recommended with between 1 and 2gb of heap memory allocated for each. |
| AS001 | The agent host certificate is not expiring in the next 90 days | Use a puppet query to find expiring host certificates. puppet query 'inventory[certname] { facts.puppet_status_check.AS001 = false }' |
| AS003 | If set, the certname is not in the wrong section of puppet.conf | The certname should only be placed in the [main] section to prevent unforeseen issues with the puppet agent. Refer to the documentation on configuring the certname. |
| AS004 | The hosts copy of the CRL does not expire in the next 90 days | Use the resolution steps in S0023. If S0023 on the primary role is true, follow this article |
How to report an issue or contribute to the module
If you have a reproducible bug, you can open an issue directly in the GitHub issues page of the module. We also welcome PR contributions to improve the module. Please see further details about contributing.
Reference
Table of Contents
Classes
puppet_status_check: puppet_status_check fact and failed indicators
Data types
Puppet_status_check::Role: puppet status check role
Plans
puppet_status_check::summary: Summary report if the state of status check on each node Uses the facts task to get the current status from each node and produces a summary report in JSON
Classes
puppet_status_check
When this class is included and enabled, any of the indicators in the puppet_status_check fact that are false will add a notify resource to the catalog. Individual indicators can be disabled by adding the ID to the indicator_exclusions parameter.
Examples
include 'puppet_status_check':
Parameters
The following parameters are available in the puppet_status_check class:
enabled
Data type: Boolean
Enable checks
Default value: true
role
Data type: Puppet_status_check::Role
Role node performs
Default value: 'agent'
indicate
Data type: Boolean
Enable notify resources for failed checks
Default value: true
indicator_exclusions
Data type: Array[String[1]]
List of disabled indicators, place any indicator ids you do not wish to report on in this list
Default value: []
checks
Data type: Hash
Hash containing a description for each check
postgresql_service
Data type: String
Name of postgresql service unit
Default value: 'postgresql'
pg_config_path
Data type: String
Path to postgresql pg_config binary
Default value: 'pg_config'
Data types
Puppet_status_check::Role
puppet status check role
Alias of Enum['primary', 'compiler', 'postgres', 'agent']
Plans
puppet_status_check::summary
Summary report if the state of status check on each node Uses the facts task to get the current status from each node and produces a summary report in JSON
Parameters
The following parameters are available in the puppet_status_check::summary plan:
targets
Data type: Optional[TargetSpec]
A comma seprated list of FQDN's of Puppet infrastructure agent nodes Defaults to using a PuppetDB query to identify nodes
Default value: undef
indicator_exclusions
Data type: Array[String[1]]
List of disabled indicators, place any indicator ids you do not wish to report on in this list Static Hiera Data can be used to set indicator_exclusions in a plan - for more information see https://www.puppet.com/docs/pe/latest/writing_plans_in_puppet_language_pe.html#using_hiera_with_plans
Default value: lookup('puppet_status_check::indicator_exclusions', undef, undef, [])
What are plans?
Modules can contain plans that take action outside of a desired state managed by Puppet. It’s perfect for troubleshooting or deploying one-off changes, distributing scripts to run across your infrastructure, or automating changes that need to happen in a particular order as part of an application deployment.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
v0.9.3 - 2024-08-07
Other
- update release.yml #14 (garrettrowell)
- Indicator exclusions affect fact output + Spec testing #11 (garrettrowell)
- Create LICENSE #10 (binford2k)
v0.9.2 - 2024-05-22
v0.9.1 - 2024-05-10
Fixed
v0.9.0 - 2024-05-02
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
Quality checks
We run a couple of automated scans to help you assess a module’s quality. Each module is given a score based on how well the author has formatted their code and documentation and select modules are also checked for malware using VirusTotal.
Please note, the information below is for guidance only and neither of these methods should be considered an endorsement by Puppet.
Malware scan results
The malware detection service on Puppet Forge is an automated process that identifies known malware in module releases before they’re published. It is not intended to replace your own virus scanning solution.
Learn more about malware scans- Module name:
- puppetlabs-puppet_status_check
- Module version:
- 0.9.3
- Scan initiated:
- August 7th 2024, 14:10:45
- Detections:
- 0 / 66
- Scan stats:
- 65 undetected
- 0 harmless
- 1 failures
- 0 timeouts
- 0 malicious
- 0 suspicious
- 13 unsupported
- Scan report:
- View the detailed scan report