How to Set up Agent-Health Notifications Using Spyctl

Overview

The spyctl create agent-health-notification-settings command in Spyctl allows you to configure notifications for agent health events. This helps you stay informed about the status (Unhealthy, Offline, Online, Healthy) of agents in your environment.

Prerequisites

Before configuring agent health notifications, ensure you have:


Step-by-Step Guide

Step 1: Identify Notification Targets

Before setting up agent health notifications, ensure you have configured notification targets. These can include:

  • Email

  • Slack Channel

  • Webhook

  • PagerDuty


Step 2: Create an Agent Health Notification Setting

Use the below command to create a new notification setting. Once configured, agent health alerts are received in real-time on the chosen targets.

Available Options

spyctl create  agent-health-notification-settings -h
Option
Description

-a, --apply

Apply the agent health notification settings during creation.

-n, --name

Custom name for the agent health notification settings. (Required)

-d, --description

Description of the agent health notification settings.

-q, --scope-query TEXT

SpyQL query on model_agents table to determine which agents the setting applies to.

-T, --targets

Comma-separated list of notification targets.

--is-disabled

Disable the agent health notification settings on creation.

`-o, --output [yaml

json

-y, --yes

Automatically answer yes to all prompts.

Creating a agent-health-notification-settings

spyctl create agent-health-notification-settings \
  --name "Agent Health Alerts" \
  --description "Alerts for agent health issues" \
  --targets "work-email"

This command creates an agent health notification setting named Agent Health Alerts, which triggers notifications for unhealthy agents and sends them to the specified targets.


Step 3: Edit an Existing Notification Setting

To modify an existing agent health notification setting, use:

spyctl edit agent-health-notification-settings <NAME_OR_UID>

For example:

spyctl edit agent-health-notification-settings "Agent-Health Alerts"

Step 4: List All Existing Notification Settings

To view all configured agent health notification settings, run:

spyctl get agent-health-notification-settings

To get a particular agent-health-notification-settings use <NAME_OR_UID>

spyctl get agent-health-notification-settings -o json

Step 5: Delete an Agent Health Notification Setting

To stop receiving agent health notification, use:

spyctl delete agent-health-notification-settings <NAME_OR_UID>

For example:

spyctl delete agent-health-notification-settings "Agent Health-Alerts"

Last updated

Was this helpful?