Hi, how can i pass variables/atributes from check results onto bash handlers?
i.e. i have a check:
{
“checks”: {
“check_no_users”: {
“command”: “/usr/lib64/nagios/plugins/check_users -w 3 -c 4” ,
“subscribers”: [“test_1”],
“interval”: 10,
“handlers”: [“sensu_log”]
}
}
}
and the handler:
{
“handlers”: {
“sensu_log”: {
“type”: “pipe”,
“command”: “echo sensu-log :::name::: >> /var/log/sensu.out”
}
}
}
I want to know how to get the variable interpreted into the handler. I have tried :::name:::, $name but no joy.
any help much appreciated.
Thanks in advance.
Would be :::check.name::: right? (as opposed to client.name or other ‘names’)
or did you want client.name?
https://sensuapp.org/docs/latest/reference/checks.html#example-check-result-output
···
On Mon, Feb 27, 2017 at 7:59 AM, shah_sensu bejenshah@gmail.com wrote:
Hi, how can i pass variables/atributes from check results onto bash handlers?
i.e. i have a check:
{
“checks”: {
“check_no_users”: {
“command”: “/usr/lib64/nagios/plugins/check_users -w 3 -c 4” ,
“subscribers”: [“test_1”],
“interval”: 10,
“handlers”: [“sensu_log”]
}
}
}
and the handler:
{
“handlers”: {
“sensu_log”: {
“type”: “pipe”,
“command”: “echo sensu-log :::name::: >> /var/log/sensu.out”
}
}
}
I want to know how to get the variable interpreted into the handler. I have tried :::name:::, $name but no joy.
any help much appreciated.
Thanks in advance.
Thanks for the response Kyle.
(Am new to Sensu and only went through your own docs this morning! They were very useful so thank you very much!)
getting either name working would be good enough for me.
I can set custom attributes, and see the results through uchiwa for example.
Just need to know how to push the same variables through to the handlers.
···
On Monday, 27 February 2017 16:07:06 UTC, Kyle Anderson wrote:
Would be :::check.name::: right? (as opposed to client.name or other ‘names’)
or did you want client.name?
https://sensuapp.org/docs/latest/reference/checks.html#example-check-result-output
On Mon, Feb 27, 2017 at 7:59 AM, shah_sensu beje...@gmail.com wrote:
Hi, how can i pass variables/atributes from check results onto bash handlers?
i.e. i have a check:
{
“checks”: {
“check_no_users”: {
“command”: “/usr/lib64/nagios/plugins/check_users -w 3 -c 4” ,
“subscribers”: [“test_1”],
“interval”: 10,
“handlers”: [“sensu_log”]
}
}
}
and the handler:
{
“handlers”: {
“sensu_log”: {
“type”: “pipe”,
“command”: “echo sensu-log :::name::: >> /var/log/sensu.out”
}
}
}
I want to know how to get the variable interpreted into the handler. I have tried :::name:::, $name but no joy.
any help much appreciated.
Thanks in advance.
i didnt understand the file type corectly and how it takes from stdin. i managed to get this working with a simple “echo $(cat) >> log”.
Now I can format the output within the handle and will also look at the sensu-mailer plugin.
···
On Monday, 27 February 2017 16:27:01 UTC, shah_sensu wrote:
Thanks for the response Kyle.
(Am new to Sensu and only went through your own docs this morning! They were very useful so thank you very much!)
getting either name working would be good enough for me.
I can set custom attributes, and see the results through uchiwa for example.
Just need to know how to push the same variables through to the handlers.
On Monday, 27 February 2017 16:07:06 UTC, Kyle Anderson wrote:
Would be :::check.name::: right? (as opposed to client.name or other ‘names’)
or did you want client.name?
https://sensuapp.org/docs/latest/reference/checks.html#example-check-result-output
On Mon, Feb 27, 2017 at 7:59 AM, shah_sensu beje...@gmail.com wrote:
Hi, how can i pass variables/atributes from check results onto bash handlers?
i.e. i have a check:
{
“checks”: {
“check_no_users”: {
“command”: “/usr/lib64/nagios/plugins/check_users -w 3 -c 4” ,
“subscribers”: [“test_1”],
“interval”: 10,
“handlers”: [“sensu_log”]
}
}
}
and the handler:
{
“handlers”: {
“sensu_log”: {
“type”: “pipe”,
“command”: “echo sensu-log :::name::: >> /var/log/sensu.out”
}
}
}
I want to know how to get the variable interpreted into the handler. I have tried :::name:::, $name but no joy.
any help much appreciated.
Thanks in advance.