How to monitor external resources with proxy requests and entities

What are Sensu proxy requests and entities?

Sensu proxy entities are entities dynamically created via either the API (and sensuctl) or the proxy_entity_name attribute of a check.

Check definitions that include the proxy_entity_name attribute will have their results reported under this proxy entity ID instead of the agent’s entity that emitted the result. In comparison, check definitions including the proxy_requests attribute will trigger a check request for each entity matched, regardless of whether that entity is a Sensu agent’s entity or a proxy entity, and the result of each check request will be reported under the matched entity and not the agent’s entity that emitted the result.

Why use proxy requests and entities?

Sensu proxy requests and entities allow Sensu to monitor external resources on systems or devices where a Sensu agent cannot be installed, like a network switch or a website.

Using a proxy entity to monitor a website

The purpose of this guide is to help you monitor an external resource, more specifically a website, by configuring a check with a proxy entity ID so an entity representing the website is created and the status of this website is reported under this entity and not the agent running the actual check. This guide requires a Sensu backend and a Sensu agent.

Installing a script

We will use a bash script, named, to perform an HTTP request using curl.

sudo curl \
-o /usr/local/bin/ && \
sudo chmod +x /usr/local/bin/

While this command is appropriate when running a few agents, you should consider using a configuration management tool or use Sensu assets to provide runtime dependencies to checks on bigger environments.

Creating the check

Now that our script is installed, the second step is to create a check named check-sensuapp, which runs the command, at an interval of 60 seconds, for all entities subscribed to the sensu-app subscription, using the proxy entity ID.

sensuctl check create check-sensuapp \
--command '' \
--interval 60 \
--subscriptions sensu-app \

Adding the subscription

To run the the check, you’ll need an agent with the subscription sensu-app. After installing an agent, open /etc/sensu/agent.yml and add the sensu-app subscription so the subscription configuration looks like:

  - "sensu-app"

Then restart the agent.

sudo systemctl restart sensu-agent

NOTE: For CentOS 6 and RHEL 6, use sudo /etc/init.d/sensu-agent restart.

Validating the check

You can verify the proper behavior of this check against the proxy entity,, by using sensuctl. It might take a few moments, once the check is created, for the check to be scheduled on the agent and the result sent back to Sensu backend.

sensuctl event info check-sensuapp

Next steps

You now know how to run a simple check to verify the status of a website. From this point, here are some recommended resources: