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.
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.
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
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.
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.
Open the Sensu Web App.
Navigate to the Sensu Web App’s dashboard.
In the workshop environment, this is available on localhost
via port 3000
.
Browser
MacOS/Linux:
open https://127.0.0.1:3000/dashboard
Windows (PowerShell)
Start https://127.0.0.1:3000/dashboard
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.
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:
Clicking this will open the namespace selection dialog, where you can search for a namespace and select the one you want to work with.
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.
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.
Open the Navigation Switcher
On the left-hand toolbar, click the namespace switcher icon.
Browser
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
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
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
).
You want to view the full list of events in Sensu, even ones that are currently passing.
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.
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
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.
You want to browse a list of nodes in your system, and get detailed information about specific entities.
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.
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.
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
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.
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.
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.
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
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.
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.
Coming Soon…
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.
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).