Getting Started with Sensu

Getting Started with Sensu

Looking to get started with Sensu? Below, I’ll walk you through a short guide to get you up and running quickly, as well as touch on some useful tips and competitive monitoring alternatives.

Sensu Requirements

Sensu’s setup requires attention to hardware and network configurations to ensure optimal performance and reliability. For the backend, a 64-bit four-core Intel or AMD CPU, coupled with at least 8 GB of RAM, forms the baseline for production environments. Storage is another critical aspect, with SSDs preferred for their speed.

Specifically, Sensu advises on provisioning storage with double the input/output operations per second (IOPS) expected from your events. Network-wise, a gigabit Ethernet offers the bandwidth needed for efficient communication between Sensu components.

For the agents, which are more lightweight, requirements start lower, with a recommendation for a 64-bit CPU and at least 512 MB of RAM for production use. Networking requirements mirror those of the backend, emphasizing the importance of a reliable and fast connection for uninterrupted monitoring.

Sensu Quick Start Install

1. Download Sensu

Begin by acquiring the Sensu software. For Docker users, this means pulling the latest Sensu Docker images suitable for your environment. Sensu provides these images with both the backend and agent included, simplifying the initial setup. Traditional installations can download packages for Debian or RHEL family distributions, catering to a variety of server setups.

You can use the following commands to install Sensu quickly:

$ wget https://github.com/riemann/riemann/releases/download/0.3.11/riemann-.tar.bz2
$ tar xvfj riemann-.tar.bz2
$ cd riemann-

To verify the checksum run the following commands:

$ wget https://github.com/riemann/riemann/releases/download/0.3.11/riemann-.tar.bz2.md5
$ md5sum -c riemann-.tar.bz2.md5

2. Configure and Start the Backend

The next step is to get the Sensu backend up and running. This can be achieved through command-line flags or a YAML configuration file, with the essential requirement being the specification of a state directory. For those deploying with Docker, this step also includes the backend’s initialization, effectively preparing the backend for immediate use with minimal fuss.

The following command is an example of how to start an agent in Docker locally and activate your subscription:

docker run -v /var/lib/sensu:/var/lib/sensu -d \
–name sensu-agent sensu/sensu:latest \
sensu-agent start –backend-url ws://sensu.yourdomain.com:8081 –log-level debug –subscriptions system –api-host 0.0.0.0 –cache-dir /var/lib/sensu

3. Initialize Sensu Backend

For installations not utilizing Docker, once the backend is active, it needs to be initialized. This process involves setting up administrator credentials, which are critical for securing access to the Sensu UI and API.

4. Access the Web UI

With the backend operational, you can now access the Sensu Web UI. This web interface is your control panel for the Sensu environment, allowing for the management and visualization of monitoring data. First-time users will log in using the administrator credentials established during the initialization process.

5. Perform a Health Check

Ensuring the backend is fully operational is crucial. This can be confirmed by making a request to the Sensu /health API endpoint. A response indicating “Healthy”: true verifies that the backend is functioning correctly and is ready to process monitoring data.

6. Install sensuctl

Sensuctl is the command-line interface for managing Sensu for Linux, Windows, and macOS.  It communicates with the Sensu backend to manage all aspects of your Sensu installation. After installing sensuctl, configure it with your backend’s URL and your user credentials to start managing your Sensu resources.

The following commands will help you get sensuctl configured using sensuctl configure.

sensuctl configure -n \
–username ‘YOUR_USERNAME’ \
–password ‘YOUR_PASSWORD’ \
–namespace default \
–url ‘http://127.0.0.1:8080’

7. Set Up Sensu Agents

The final piece of the setup is the Sensu agents. Install and start these agents on the devices you wish to monitor, configuring them to communicate with your Sensu backend. These agents can be fine-tuned with subscriptions to specify the monitoring checks they should execute.

You can configure the Sensu agent with sensu-agent start flags or use the YML config file. The Sensu agent requires the –backend-url flag at minimum. Below is an example of starting the agents in a Debian environment:

# Copy the config template from the docs
sudo curl -L https://docs.sensu.io/sensu-go/latest/files/agent.yml -o /etc/sensu/agent.yml
# Start sensu-agent using a service manager
sudo systemctl start sensu-agent

8. Verify the Installation

To ensure everything is correctly set up, test your Sensu installation by verifying agent keepalives and generating test events. This confirms that agents are actively reporting to the backend and that the monitoring pipeline is operational, ready to alert you to issues as they arise.

To do this, check the entity page in the Sensu web UI, or run sensuctl entity list.

Sensu Tips

Once you’re up and running, consider implementing some of the tips below to get the most out of Sensu.

Efficient Use of Sensu Agents

Utilize Sensu’s agent API for dynamic registration of new nodes in auto-scaling environments. This ensures new instances are automatically monitored without manual intervention.

Advanced Event Filtering

Master Sensu’s event filtering capabilities to reduce noise. Use filters to ignore recurring non-critical events or to only alert on specific conditions, improving the signal-to-noise ratio.

Command Example:

sensuctl filter create high-cpu –action allow –statements ‘event.check.cpu > 90’

Utilizing Handlers for Automation

Configure handlers for automated remediation tasks. For example, automatically restart a service if it’s failing health checks.

Command Example:

sensuctl handler create restart-service –type pipe –command ‘restart-service-handler.sh’

Custom Monitoring Checks

Develop custom monitoring checks tailored to your application’s specific requirements. Sensu’s flexibility allows you to script in any language.

Command Example:

sensuctl check create disk-usage –command ‘check-disk-usage.sh’ –interval 60 –subscriptions system

Asset Management for Plugins

Leverage Sensu Assets for deploying plugins across your infrastructure. Assets can dynamically download and use binaries and scripts, ensuring your monitoring tools are consistent and up-to-date.

Command Example:

sensuctl asset add sensu/sensu-disk-checks

Configuration as Code

Store your Sensu configurations (checks, handlers, filters, etc.) in a version control system. This practice supports the monitoring as code approach, enabling collaboration, history tracking, and rollback capabilities.

Performance Optimization

Regularly monitor and tune your Sensu backend’s performance, especially in large-scale environments. Adjust the backend’s configuration parameters to handle your specific workload efficiently.

Effective Use of Labels and Annotations

Use labels and annotations in your Sensu entities, checks, and events to enrich your monitoring data. This metadata can be invaluable for filtering, querying, and dashboarding purposes.

Secure Sensu Implementation

Always secure communication between Sensu agents and the backend using TLS encryption. Manage access controls and permissions diligently to ensure that only authorized users can make changes to your monitoring setup.

Regular Review and Cleanup

Regularly review and remove unused checks, handlers, filters, and assets. Keeping your Sensu configuration lean helps maintain clarity and reduces the load on your system.

Sensu Features

  • Flexible Monitoring Agents Sensu’s architecture is centered around its lightweight and highly configurable agents. These agents can be deployed across a wide array of environments, from on-premises servers to cloud-based containers, capturing data on everything from system metrics to application performance. The real power lies in their dynamic configuration, enabling quick adaptations to your evolving monitoring needs.
  • Event Pipeline At the core of Sensu’s functionality is its event pipeline, which processes and manages events according to user-defined rules. This automated pipeline allows for the filtering, mutating, and handling of events, empowering users to direct alerts to the right destinations, automate responses, and integrate with external systems for deeper event analysis.
  • Rich Observability Data Sensu excels in aggregating a variety of observability data, including metrics from popular formats like Nagios and Prometheus. This capability ensures that users can seamlessly collect, convert, and forward data to their storage solution of choice, offering a comprehensive view of system health and performance across the board.
  • High Availability and Scalability Designed with enterprise needs in mind, Sensu’s backend cluster offers both high availability and scalability. It ensures uninterrupted monitoring across large-scale infrastructures and multiple locations, providing the resilience and performance necessary for modern, distributed systems.
  • Comprehensive API Sensu’s RESTful API opens up a world of possibilities for automation and integration. It allows users to programmatically manage resources, automate monitoring tasks, and create custom integrations, extending Sensu’s capabilities far beyond its standard offerings.
  • Sensu Go Web UI For those who prefer graphical interfaces, the Sensu Go Web UI delivers a convenient and intuitive way to manage the monitoring environment. It offers at-a-glance insights into your infrastructure’s status, detailed event information, and easy access to configuration options, all aimed at simplifying the monitoring process.

Sensu Capabilities and Scope

Sensu introduces a unique approach to monitoring and observability, streamlining the process by deploying agents across your infrastructure. Unlike traditional methods that require individual provisioning for each component, Sensu simplifies the workflow.

By installing the lightweight Sensu agent on your devices, servers, or containers, you’re set to begin. These agents are tasked with generating and sending status and metric events directly to the Sensu backend, automating registration and connectivity without extra steps. Just point them to the Sensu backend server’s IP, and you’re good to go.

The power of Sensu lies in its backend, driven by an embedded transport and etcd datastore. It dispatches specific checks to agents based on their subscriptions, dynamically scheduling and executing checks downloaded from an asset repository. This setup not only facilitates automated monitoring but also enables flexible, efficient management of events through Sensu’s event pipeline.

Sensu’s architecture emphasizes minimal overhead for agents, while ensuring robust data storage and event management in the backend. It includes essential requirements for persistent storage, local asset caching, and maintaining open ports to support its operational needs. Agents require some disk space for caching dynamic runtime assets, ensuring smooth operation.

To set up and maintain this infrastructure, Sensu utilizes a variety of ports for communication between the backend and agents, covering everything from the Sensu web UI to the agent API. This network configuration is crucial for seamless interaction and data flow within the Sensu ecosystem.

Sensu Pricing

Sensu operates on a tiered pricing model, catering to a wide range of use cases, from small projects to large enterprise environments. The core monitoring functionality is available under an open-source license, while advanced features and commercial support are offered under a subscription model. Here’s an overview:

  • Sensu Go Free Sensu Go Free is an excellent starting point for new users, individuals, and very small teams exploring Sensu’s capabilities. This plan is completely free, offering unlimited evaluation without the need for a trial. It supports up to 100 nodes and a single site, with access to commercial features. However, it does not include commercial support or guaranteed response times. This plan is ideal for getting acquainted with Sensu Go’s core features.
  • Sensu Go Pro The Sensu Go Pro plan is tailored for small to medium-sized businesses (SMBs) and enterprise product teams, priced at $3 USD per node each month when billed annually. It requires a minimum of 100 nodes and can scale up to 3000 nodes. This plan is limited to one site but includes both commercial features and support, with a six-hour response time SLA for any issues. A 14-day trial is available, offering a great way for teams to test drive Sensu’s advanced capabilities.
  • Sensu Go Enterprise Designed for large teams managing mission-critical systems, the Sensu Go Enterprise plan is set at $5 USD per node per month, with annual billing. Starting at 300 nodes, this plan allows for unlimited node expansion and supports multiple sites, making it perfect for large-scale operations. It includes all commercial features, commercial support, and boasts a three-hour response time SLA. Like the Pro plan, a 14-day trial is available to help teams evaluate the platform’s fit for their needs.

Sensu Alternatives

If you’re not happy with Sensu, or just looking for something different, below are three similar highly scalable monitoring platforms I’d recommend.

1. SolarWinds sFlow Monitor (FREE TRIAL)

sFlow Collector Tool

SolarWinds sFlow Monitor specializes in network performance monitoring, leveraging sFlow technology to provide real-time visibility into network traffic and bandwidth usage.

It’s designed to help IT professionals quickly detect, diagnose, and resolve network performance issues. SolarWinds stands out for its comprehensive network device support and intuitive, graphical representation of network flows, making it an excellent option for organizations with extensive network infrastructure looking to pinpoint bottlenecks and optimize traffic.

SolarWinds sFlow Monitor Start a 30-day FREE Trial

2. Datadog

Datadog graphs and charts

Datadog offers a cloud-based platform that provides monitoring and analytics across a vast array of IT infrastructure, including applications, databases, tools, and services. With an emphasis on real-time performance monitoring and scalability, Datadog integrates seamlessly with hundreds of common applications and services.

Its strength lies in its ability to correlate data from servers, databases, tools, and services to present a unified view of an organization’s entire stack. Datadog is particularly well-suited for dynamic, cloud-based environments requiring detailed insights into application performance and user experiences.

3. Nagios

Nagios XI dashboard

Nagios is a veteran in the monitoring space, offering solutions that range from basic network monitoring to enterprise-level infrastructure management. Nagios Core, the free, open-source version, provides basic monitoring capabilities, while Nagios XI, the commercial version, extends functionality with a more intuitive interface, enhanced reporting, and configuration features.

Nagios excels in its flexibility, supported by a vast library of plugins developed by its community. It’s an ideal choice for organizations looking for a customizable solution that can be tailored to specific monitoring needs, from simple networks to complex distributed systems.

Leave a Reply