[Sensu Go Workshop] Lesson 11: Using the Sensu Web App

In this lesson, we will introduce the Sensu Web Application. In the Sensu web app, you will find an overview of the system in the dashboard, learn to navigate and inspect Sesnu resources, and create and delete silences. This lesson is intended for operators of Sensu and assumes you have set up a local workshop environment.

By: Caleb Hailey

Lesson 11: Using the Sensu Web App

Goals

In this lesson we will introduce the Sensu Web Application. In the Sensu web app, you will find an overview of the system in the dashboard, learn to navigate and inspect Sesnu resources, and create and delete silences. This lesson is intended for operators of Sensu and assumes you have set up a local workshop environment.

A Visual Overview of Your System

When you first connect to the Sensu Web App, you will see the dashboard. This view shows a general overview of your system.

You can access this within the workshop by opening https://127.0.0.1:3000 in a browser.

Example: Launching the Sensu Web App from a Command-Line

open https://127.0.0.1:3000

EXERCISE 1: Entity Scavenger Hunt

Scenario

You want a quick visual understanding of the state of your system. While sensuctl provides a versatile tool, it’s a little too granular. You’d like to see a big-picture view from your web browser.

Specifically, you want to find out how many entities are in your system overall.

Solution

Sensu includes a built-in web app, with a dashboard, hosted by the backend. The dashboard shows a lot of useful information, including a count of entities in your system.

Steps

  1. Open the Sensu Web App.

    Navigate to the Sensu Web App’s dashboard. In the workshop environment, this is available on localhostvia port 3000.

    Browser

    The Sensu Dashboard
    Figure 1: The Sensu Dashboard provides a high-level overview of your system..

    MacOS/Linux:

    open https://127.0.0.1:3000/dashboard
    

    Windows (PowerShell)

    Start https://127.0.0.1:3000/dashboard
    
  2. Find the Count of Entities

    • Scavenger Hunt: How many entities are available?

      On the dashboard you should be able to easily, and intuitively locate this information.

  3. Verify Against the Sensu CLI

    The same information is available from the sensuctl CLI tool, however it is more difficult to derive this information.

    sensuctl entity list --format json | jq '. | length'
    

    Do these two numbers match? Which one was easier/faster to work with?

In Sensu, most Sensu data is accessed on a per-namespace basis. The web app allows you to easily switch between different namespaces.

To select the namespace, first go to the left-hand sidebar and click the namespace selector:

The Namespace Switcher
Figure: The namespace switcher, available from the left-hand sidebar, opens a dialog that allows you to pick which namespace you wish to view/interact with.

Clicking this will open the namespace selection dialog, where you can search for a namespace and select the one you want to work with.

EXERCISE 2: Select a Namespace

Scenario

You want to use the web app to interact with resources like events, entities, checks and handlers. Since these are all scoped by namespace, you must first select a namespace to view.

Solution

To switch namespaces, use the namespace selector. When you switch to a namespace, the left navigation menu will load, providing access to the various Sensu resources.

Steps

  1. Open the Navigation Switcher

    On the left-hand toolbar, click the namespace switcher icon.

    Browser

    Namespace Switcher

  2. Find the default Namespace

    So far in the workshop, we are only working with the default namespace. You can either browse the list of namespaces, or search for it by typing the name.

    Browser

    Namespace Selector

  3. Observe the New Toolbar Options

    After selecting the namespace, you’ll notice that new options appeared in the left-hand toolbar. You now have access to your events, entities, and much more.

    Browser

    Left Navigation

View Event Data

When you select a namespace, the first thing you’ll see is the events list. The events list can be filtered using Sensu Query Expressions (SQE), just like the filters we previously wrote for our handler.

By default, this list has an automatic filter to show only events with a non-passing status (i.e. event.check.state != passing).

Default Events List Filter
Figure: The default filter for the events list only shows events that are with a non-passing status.

EXERCISE 3: View All Events

Scenario

You want to view the full list of events in Sensu, even ones that are currently passing.

Solution

The events list has a default filter that only shows events in a non-passing status. To show all events, we need to remove this filter.

Steps

  1. Remove the Default Filter

    Click on the text-box and remove the contents. Hit enter to update the list.

    Browser

    https://user-images.githubusercontent.com/478164/138917565-6a3c0b3f-8e49-4957-9671-e4769eb3d0a7.mov

View Inventory Data

In a [previous lesson][lesson-3] we discussed how Sensu can be used to mantain an inventory of nodes. This list of entities can also be viewed from the Sensu web app.

EXERCISE 4: View Agent Entities

Scenario

You want to browse a list of nodes in your system, and get detailed information about specific entities.

Solution

To accomplish this, navigate to the entity list in the Sensu Web App. This list has search and filter controls as well as some handy bulk functions like silencing and deleting entities.

Steps

  1. Navigate to the entity list.

    In the left-hand toolbar, click the icon that looks like a computer screen. This will bring up a list of all entities in the system.

    Entity List Button

  2. Search for a specific entity.

    At the top of the list, there is a search bar, which allows you to use Sensu Query Expressions (SQE) to filter the list of entities.

    Try typing in the entity learn.sensu.io. Sensu will automatically understand that you’re looking for an entity with that name and populate the search box with the correct SQE.

    NOTE: You can also click on any entity to view its properties in detail.

    https://user-images.githubusercontent.com/478164/138918610-fc2f0e74-4ba5-4308-9f73-f7efead9220c.mov

Managing Silences

Users can use the Sensu web app to silence individual events (for a single entity), all events produced by a specific check (across multiple entit ies), or all events for a specific entity.

Silencing may be applied from various different locations in the Sensu web app, with prompts to configure the silencing rules (which check and/or entity should be silenced), schedule (e.g. to begin immediately, or create a “scheduled maintenance” window), and the reason for the silencing.

EXERCISE 5: Create a Silence for an Entity

Scenario

You want to silence alerts from a particular node so that you can do some maintenance on it, and prefer to use the web app for this task.

Solution

The Sensu web app allows you to manage silences in many places. To configure a silence for a specific entity, we can navigate to to entity detail page, and create a silence directly from there. This will be auto-populated with the correct entity-specific subscription.

Steps

  1. Create a silence for an entity

    First navigate to the entity list, and select the workshop entity. Next, click the SILENCE button to the right of the entity name. This will display a modal window where you can create a silence.

    The silence’s subscription will automatically be populated for the workshop entity.

    If you add a check name, it will silence only events from that check, or if you leave that as default, it will silence all events coming from that entity.

    https://user-images.githubusercontent.com/478164/138918724-2818d4ab-2171-4f12-964d-55cdef2a505d.mov

  2. Delete a silence.

    Navigate to the list of silences via the left-hand toolbar, or by clicking on the popup alert. You will see the silence we just made. Click on the right hand dots menu and select “Clear Silence”, then confirm.

    The silence is now deleted.

View and Modify Resource Configurations

The Sensu web app also provides access to the core monitoring configuration, including Checks, Fitlers, Mutators, and Handlers. The configuration views may be accessed from the navigation sidebar. Each of the configuration resources provides list + detail views, as well as the ability to create and/or edit configuration resources (e.g. modify check or handler configuration), assuming the user has the appropriate RBAC permissions.

The configuration navigation

EXERCISE 6: Modify a Check

Coming Soon…

Discussion

In this lesson you learned the basics of how to navigate the Sensu Web Application, including how to view inventory, add and remove silences, and modify check configurations.

Web App is Just Another API Client

Sensu’s monitoring as code solution is possible thanks to a robust set of APIs. The Sensu web app and CLI are effectively just API clients that streamline access to these APIs. Both tools have access to the same information and give you the power to view and change Sensu resources, using different paradigms. Use whichever tool works best for your workflow.

To learn more about the Sensu APIs, please checkout the Sensu API Reference Documentation and Sensu Developer Workshop (coming soon).

Learn More

Next Steps

Share your feedback on Lesson 11

Next Lesson

Previous Lesson