Sensu trigger event manually

Sensu says: A Sensu event is raised when a test result indicates a state change.

Is it possible to create a custom event that is not the result of validation?

The Sensu API does not have a command to create an event: https://sensuapp.org/docs/latest/api-events .

+4
source share
1 answer

Yes, but he will check Uchiwa - even though he is not defined in sensu.

See this page: https://sensuapp.org/docs/0.16/external_result_input

On the client (linux) I ran;

echo '{ "name": "my_check", "output": "some output", "status": 0 }' > /dev/tcp/localhost/3030

And it magically appeared in Uchiwa under this list of customer checks.

Then I ran it again when the status field is set to 1:

echo '{ "name": "my_check", "output": "some output", "status": 1 }' > /dev/tcp/localhost/3030

Uchiwa .

2 , , . 0 .

, , , PHP/Python/Anywhere , sensu, , . JSON, , .

:

echo '{ "name": "trickyCheck", "output": "cake is delicious", "status": 0, "handler": "handlerOfDoom", "link": "http://cats.com" }' > /dev/tcp/localhost/3030

Handler:

{
  "handlers": {
    "handlerOfDoom": {
      "type": "pipe",
      "command": "doSomethingCool.rb",
      "severities": ["warning","critical"]
      }
    }
  }
}

script JSON; , , .. , , .

Sensu Windows tcp localhost. https://serverfault.com/questions/629682/send-text-string-to-a-socket-in-windows

+5

Source: https://habr.com/ru/post/1620787/


All Articles