Custom monitoring checks

Custom monitoring checks

In addition to the built-in checks, you can define your own monitoring checks in SC//Reliantâ„¢ Platform Manager. This page describes the custom check types, their parameters, and examples. For an overview of how the platform uses Sensu, see Sensu (monitoring).

In addition to the built-in service checks, you can define your own using the Custom Checks hash in the Sensu Go Check Configurations property in SC//Reliant Platform Manager. For more information about the built-in checks, see Monitoring check reference.

Custom check types

The Custom Checks hash contains a separate hash for each type of custom check you can create:

Hash Description
Process Checks Customized process checks for Linux hosts. Monitors that a specific process is running, identified by its PID file.
Windows Process Checks Custom process checks for Windows hosts. Monitors that a specific Windows process is running, identified by its process name.
SensuGo Server status A Sensu Go server check that monitors a Sensu Go server, or cluster of Sensu Go servers, in the management plane to verify the servers are healthy.

Common properties

Each item in a custom check hash defines one check. Use Add new value to define additional checks, and Remove Item to delete a check. Every custom check type shares the following properties.

Property Description
Check name The name of the check. This value is also used as the default subscription for the check.
Parameters The check variables. The available parameters depend on the check type. See Check type parameters.
Schedule When the check runs. You can schedule checks using the interval or cron properties. Checks must include either an interval attribute or a cron attribute. The cron attribute has priority over the interval.
Controls Fine-grained check tuning parameters, such as the timeout, time to live (TTL), and flap thresholds. These are the same controls available on the built-in checks. For more information, see Configuring monitoring checks.
Handlers The handler(s) used to route the check's events to a destination. For more information, see Configuring monitoring handlers.
Subscriptions Any additional subscriptions for the check. The default subscription value is the check name. Use Add new value to add each additional subscription. See Using subscriptions.

Check type parameters

The Parameters section contains the check variables specific to each check type.

Check Type Parameters Description
Process Checks PID File (required) The PID file of the process to monitor. The PID File requires an absolute path. Relative paths, such as mcollective.pid or ../mcollective.pid, are not valid and will prevent the check from being created.
Windows Process Checks Process Name (required) The Windows process name to monitor. Acceptable values are names with letters, numbers, empty spaces, underscores, and hyphens, and the name can be provided with or without the executable suffix. For example, spoolsv, sensu-agent.exe, custom 64.exe, Appinfo, or Process_32.exe. Paths, such as C:\opt\bin\sensu-agent.exe or ../sensu-agent.exe, are not valid and will prevent the check from being created.
SensuGo Server status Host The load balancer DNS endpoint, or the hostname or IP address, of the Sensu Go server or cluster to monitor.
Port The API port of the Sensu Go server or cluster.

Process check behavior

Process checks, on both Linux and Windows hosts, only verify whether a process is running. They do not count how many processes are running: if one or more processes with the given name or PID file are running, the check returns OK, and if no process is found running, the check returns CRITICAL.

If a service spawns multiple processes with different names, create an additional check for each process. You can assign the same additional subscription to all of the related checks so they can be managed together. See Using subscriptions.

SensuGo server status check behavior

The warning and critical thresholds for the SensuGo server status check type are defined by the percentage of Sensu Go cluster nodes that are offline. The threshold for a warning alert is 20% and for a critical alert is 40%. The following summarizes the expected results when monitoring different Sensu Go cluster configurations.

Sensu Go Cluster Configuration Success Warning Critical
3-node cluster All nodes online 1 node offline 2+ nodes offline
5-node cluster All nodes online 1 node offline 2+ nodes offline
7-node cluster Up to 1 node offline 2 nodes offline 3+ nodes offline

For a standalone Sensu Go server, there are only two results: success (node online) and critical (node offline).

Using subscriptions

Sensu uses subscriptions to determine which agents run a check. By default, each custom check receives a subscription with the same name as the check. For a check to run, its subscription must be added to the Sensu Go agent configuration.

Additional subscriptions can be added to a custom check definition. This allows you to configure the same additional subscription on multiple checks, then add that single subscription to the Sensu Go agent configuration to enable all of the related checks at once. This is useful for services that require multiple process checks, such as the eSocket example below.

Examples

The following example configurations show how the custom check types can be used.

Linux process check (mCollective)

Process Check Name PID File Subscriptions
mCollective mcollective /var/run/puppetlabs/mcollective.pid

Multi-process service (eSocket)

The eSocket service is comprised of three processes, so each process requires its own custom process check. Defining the same additional subscription, esocket, on all three checks allows them to be enabled with a single subscription in the Sensu Go agent configuration.

Process Check Name PID File Subscriptions
eSocket ESP esocket_esp /var/run/esocket/esocket-esp.pid esocket
eSocket Config Agent esocket_config_agent /var/run/esocket/esocket-config-agent.pid esocket
HSQLDB esocket_hsqldb /run/hsqldb.pid esocket

Windows process checks (Spooler and MSSQL)

Service Check Name Process Name Subscriptions
Spooler spooler_check spoolsv.exe
MSSQL mssql_check sqlservr windows_server