Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
Hello Ninjas!! Welcome back to one more article on Puppet. This article is about Viewing and Managing Puppet Server Metrics. This article will discuss how we can track performance and view real-time metrics. We will learn different ways through which we can do this. We will learn about Graphite and Available Graphite Metrics in this section.
Before moving on to our topic, First, let’s see what Puppet is.
Puppet
Puppet is an open-source systems tool used on various platforms like IBM mainframes, Cisco routers, and Mac OS servers for configurational management.
It is used to configure, deploy, and manage servers. It gives you control over your configured computers, so centralized changes are immediately propagated to everyone.
Now let’s understand the different techniques used for viewing and managing puppet server metrics.
View and Manage Puppet Server Metrics
Puppet provides us with many techniques with which we can view status metrics and track performance to timely monitor the server's health and performance. Let’s look at them:
We can use the Puppet Report Viewer app for Splunk. The add-on modules required are splunk_hec and pe_event_forwarding.
The Status API and Metrics API can be used.
We can make use of the puppet_operational_dashboards module and puppet_metrics_collector module, which are bundled with Puppet Enterprises.
Last, Grafana instances, Customizable, and networked Graphite are also used.
Now, we will discuss Graphite in detail.
Graphite
A third-party monitoring tool, Graphite offers various customized ways to see real-time information and store them. We can export numerous metrics from Puppet Enterprise (PE) to Graphite. When Graphite support is enabled, Puppet Server automatically exports a set of metrics that are intended to be instantly helpful to Puppet administrators. Graphite requires additional server resources and considerable configuration.
Before learning more about it, let’s discuss using Graphite with PE.
First, install the Graphite Server and configure it.
Now activate Graphite support in Puppet Server.
We can also use the Grafana dashboard extension, which is available for Graphite, to visualize the metrics.
The grafanadash Module
Grafana is used to visualize, understand, and monitor the solution for databases. It provides a customizable web-based dashboard that is compatible with Graphite. A minimal Graphite test instance with the Grafana extension is installed via the grafanadash module.
Now we will see how we can install and run the grafanadash module.
Installing the grafanadash Module
We will install the grafanadash module on a devoted *nix agent. The class we will be using is grafanadash::dev to install and configure the demands of a Graphite server, the default dashboard, and the Grafana extension.
Follow these steps to install the module:
Install a specific *nix PE agent to act as the Graphite server. Consult Installing agents for detailed instructions
Run the sudo puppet module install puppetlabs-grafanadash as root on the agent node.
Run sudo puppet apply -e ‘include grafanadash::dev’ on the agent node as root.
Run Grafana
Now next step after installation is to run Grafana. In this section, we will learn the steps to run the grafanadash module.
The grafanadash module sets port 10000 as the default port for Grafana's web-based dashboard, which runs on that platform. You must set up a metrics dashboard to view Puppet Server metrics in Grafana.
A metrics dashboard must be created or modified before imported, such as our sample metrics dashboard JSON file, as puppet does not by default display Puppet metrics.
Follow these certain steps:
Launch a web browser on a machine that can connect to your grafanadash agent node and go to http://AGENT HOSTNAME>:10000. Grafana's ability to communicate with your Graphite server will be shown on a test screen.
Grafana may be set up to use a hostname that your computer cannot resolve. To find out what hostname Grafana is attempting to use, click View information and switch to the Requests tab. The host's file should then contain the IP address and hostname.
On Unix/Linux and macOS agents, the file is located at/etc/hosts
On Windows agents, the file is located at C:\Windows\system32\drivers\etc\hosts
Open the sample metrics dashboard JSON file in a text editor on the same computer you use to access Grafana after downloading it and saving it as sample_metrics_dashboard.json.
Now replace primary.example.com with the hostname of your primary server throughout the file.
Save this file.
Now go to Search (Folder icon) > Import > Browse in the Grafana UI and select your sample_metrics_dashboard.json file by clicking it.
After following the above steps, a dashboard will be loaded with nine graphs showing different metrics exported from the Puppet Server to the Graphite server. However, these graphs are empty unless you enable Graphite support for the Puppet Server.
Enable Puppet Server’s Graphite Support
In the previous sections, we learned how to install and run the grafanadash module. To set up the metrics output settings for Puppet Server, use the PE Controller node group in the Puppet Enterprise (PE) console. Refer to the steps given below:
First, navigate Node groups > PE Infrastructure > PE Master in the PE console.
Now there is a class puppet enterprise::profile::master on the Classes tab; locate it and add the following parameters:
If your Graphite server doesn't make use of a shared port, make sure the following settings are set to their default values:
At last, after confirming these, Commit the changes.
Till now, everything should be clear about Graphite; let’s discuss the properties and types in which Graphite metrics are divided.
Graphite Metrics Properties
The metrics are divided into three groups based on the prefixes and suffixes used by each metric. Prefixes like puppetlabs.<PRIMARY_HOSTNAME> and suffixes like <PRIMARY_HOSTNAME>.compiler.mean are used for each metric.
For example - Thenum-cpus metric is referred to by puppetlabs.<PRIMARY_HOSTNAME>.num-cpus. Examples of suffixes by fields include puppetlabs.<PRIMARY_HOSTNAME>.compiler.mean where mean help the metrics return only the mean length time to compile a catalog.
Now let’s look at the classification of metrics on this basis:
Statistical metrics: In addition to the top-level metric fields, it has additional analysis fields that are displayed below
Counters only: In this type of metric, only count fields are there that only count a value.
Other Metrics: Metrics in which all the available fields are unique set comes under this category
Frequently Asked Questions
What is puppet, and how does it work?
An open-source tool for managing and deploying software configuration is called Puppet.Puppet offers the capability to specify the software and configuration that a system needs and then, after initial setup, maintain a given state.
What are puppet reports?
We can customize the built-in report processors in Puppet. By default, Puppet creates a report after applying a catalog that contains details about the Run, including events, log messages, resource statuses, metrics, and metadata. Each host transmits a YAML dump of its report.
What is the most basic unit for modeling in puppets?
Modeling system setups begin with resources. A resource, such as a package or service, describes a specific aspect of a system. It goes to puppet and asks about adding it to the catalog.
What task can Puppet perform?
Puppet is an open-source Configuration Management tool most commonly used on Linux and Windows for configuring, deploying, and managing servers. External services can use performance and status metrics from Puppet Server to track the health and performance of a server over time.
Conclusion
So today’s article, Viewing and Managing Puppet Server Metrics, comes to an end. We have covered techniques for it. We have learned about Graphite, thegrafanadash module, and how to install and run it.
Are you interested in reading/exploring more about Puppet? Don't worry; Coding Ninjas has you covered.