Can I use sensu-api to send external results to sensu-client?


#1

I’ve learned that other applications could send external result (check information) to sensu-client process through tcp socket. This method works fine for me.
In addition to this method, I wondered can I construct another web-service/api (like sensu-api) for sending external results to sensu-client, just like we can use sensu-api to access sensu information.


#2

The sensu-api is restful and doesn't really represent a "client" like
the sensu-client does.
The client-info is currently required
(https://github.com/sensu/sensu/issues/541), so the sensu-api wouldn't
really have client-info to associate with it.

But, I think you certainly could create an http interface to POST
external check data!
For a very simple start it could forward on the POST data right into
the localhost:3030 socket?

···

On Mon, Apr 13, 2015 at 8:28 PM, Timothy John <tim_john@126.com> wrote:

I've learned that other applications could send external result (check
information) to sensu-client process through tcp socket. This method works
fine for me.
In addition to this method, I wondered can I construct another
web-service/api (like sensu-api) for sending external results to
sensu-client, just like we can use sensu-api to access sensu information.


#3

This may get you started

https://github.com/yieldbot/sensu-yieldbot-plugins/blob/master/plugins/sensu/sensu-socket-client.rb

We use this for a variety of reasons. Just give it some output, tell it what handler to use, and it will convert it all to json and push it onto the client for transmission to the server.

./sensu-socket-client.rb --output “sample output” --name “random client check” --handler "slack-handler --status 2

Example Usage:

  • floating consul checks up to sensu

  • graceful shutdown of the client

  • random health output from a custom app

···

On Mon, Apr 13, 2015 at 11:50 PM, Kyle Anderson kyle@xkyle.com wrote:

The sensu-api is restful and doesn’t really represent a “client” like

the sensu-client does.

The client-info is currently required

(https://github.com/sensu/sensu/issues/541), so the sensu-api wouldn’t

really have client-info to associate with it.

But, I think you certainly could create an http interface to POST

external check data!

For a very simple start it could forward on the POST data right into

the localhost:3030 socket?

On Mon, Apr 13, 2015 at 8:28 PM, Timothy John tim_john@126.com wrote:

I’ve learned that other applications could send external result (check

information) to sensu-client process through tcp socket. This method works

fine for me.

In addition to this method, I wondered can I construct another

web-service/api (like sensu-api) for sending external results to

sensu-client, just like we can use sensu-api to access sensu information.

Matt Jones @DevopsMatt

Infrastructure Engineer - Yieldbot Inc.

Core Contributor - Sensu Plugins

https://linkedin.com/in/mattyjones


#4

Thanks, Kyle! “create an http interface” is exactly what I want to do. I intend to use “sinatra” framework (which the sensu-api use) to create an sensu-api like interface for POST external check data, is that a good way to go?

在 2015年4月14日星期二 UTC+8上午11:50:48,Kyle Anderson写道:

···

The sensu-api is restful and doesn’t really represent a “client” like
the sensu-client does.
The client-info is currently required
(https://github.com/sensu/sensu/issues/541), so the sensu-api wouldn’t
really have client-info to associate with it.

But, I think you certainly could create an http interface to POST
external check data!
For a very simple start it could forward on the POST data right into
the localhost:3030 socket?

On Mon, Apr 13, 2015 at 8:28 PM, Timothy John tim_...@126.com wrote:

I’ve learned that other applications could send external result (check
information) to sensu-client process through tcp socket. This method works
fine for me.
In addition to this method, I wondered can I construct another
web-service/api (like sensu-api) for sending external results to
sensu-client, just like we can use sensu-api to access sensu information.


#5

Thanks Matt! That plugin works great for me :slight_smile:

在 2015年4月14日星期二 UTC+8下午12:01:08,Matt Jones写道:

···

This may get you started

https://github.com/yieldbot/sensu-yieldbot-plugins/blob/master/plugins/sensu/sensu-socket-client.rb

We use this for a variety of reasons. Just give it some output, tell it what handler to use, and it will convert it all to json and push it onto the client for transmission to the server.

./sensu-socket-client.rb --output “sample output” --name “random client check” --handler "slack-handler --status 2

Example Usage:

  • floating consul checks up to sensu
  • graceful shutdown of the client
  • random health output from a custom app

On Mon, Apr 13, 2015 at 11:50 PM, Kyle Anderson ky...@xkyle.com wrote:

The sensu-api is restful and doesn’t really represent a “client” like

the sensu-client does.

The client-info is currently required

(https://github.com/sensu/sensu/issues/541), so the sensu-api wouldn’t

really have client-info to associate with it.

But, I think you certainly could create an http interface to POST

external check data!

For a very simple start it could forward on the POST data right into

the localhost:3030 socket?

On Mon, Apr 13, 2015 at 8:28 PM, Timothy John tim_...@126.com wrote:

I’ve learned that other applications could send external result (check

information) to sensu-client process through tcp socket. This method works

fine for me.

In addition to this method, I wondered can I construct another

web-service/api (like sensu-api) for sending external results to

sensu-client, just like we can use sensu-api to access sensu information.


Matt Jones @DevopsMatt

Infrastructure Engineer - Yieldbot Inc.

Core Contributor - Sensu Plugins

https://linkedin.com/in/mattyjones