sensu server doesn't get response

Hi,

I configured sensu server as below.

In the server side
/etc/sensu/conf.d/check_cron.json
{
“checks”: {
“cron_check”: {
“handlers”: [“default”],
“command”: "/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",
“interval”: 60,
“subscribers”: [ “webservers” ]
}
}
}

and on the cilent side the client.json is as below and installed check-procs.rb in /etc/sensu/plugins on the client side.

{
“client”: {
“name”: “clientvm2.sensu.biz”,
“address”: “172.16.132.131”,
“subscriptions”: [ “test”, “webservers” ]

}
}

and restarted sensu server,api and sensu clients.

from the sensu-server.log on the server side I could find the server published the request

{“timestamp”:“2014-05-06T11:20:04.669414-0700”,“level”:“info”,“message”:“publishing check request”,“payload”:{“name”:“cron_check”,“issued”:1399400404,“command”:"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "},“subscribers”:[“webservers”]}

from the sensu-client.log on the client side, I could the see the request has been recieved from the server and the client processed the check-procs.rb and published the result that the crond service is not running.

“timestamp”:“2014-05-06T11:
27:59.099184-0700”,“level”:“info”,“message”:“received check request”,“check”:{“name”:“cron_check”,“issued”:1399399864,“command”:"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "}}

{“timestamp”:“2014-05-06T11:27:59.234294-0700”,“level”:“info”,“message”:“publishing check result”,“payload”:{“client”:“clientvm2.sensu.biz”,“check”:{“name”:“cron_check”,“issued”:1399399864,“command”:"/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",“executed”:1399400879,“output”:“CheckProcs CRITICAL: Found 0 matching processes; cmd /crond/\n”,“status”:2,“duration”:0.134}}}

The problem is I was expecting the response in the server side logs as client published the result. I couldn’t see any response logs in the server side as client published the result of the script check-procs.rb

I could see only the below logs in the sensu-server.log on the server side
{“timestamp”:“2014-05-06T11:20:04.793113-0700”,“level”:“error”,“message”:“unknown handler”,“handler_name”:“default”}
{“timestamp”:“2014-05-06T11:20:04.871434-0700”,“level”:“error”,“message”:“unknown handler”,“handler_name”:“default”}

and on the dashboard there is a status " sh: /etc/sensu/plugins/check-procs.rb: No such file or directory" when the crond service is running on the client side. I haven’t put the check-procs.rb in the server side.

Could anyone let me know what was problem with the above configuration and how I can get the response of the client script that has been published?

Thanks,
Maha

I think you need to put the check_procs check on the server side.

Also this leads me to believe you have your handles misconfigured

27:59.099184-0700",“level”:“info”,“message”:“received check request”,“check”:{“name”:“cron_check”,“issued”:1399399864,“command”:"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "}}

{“timestamp”:“2014-05-06T11:27:59.234294-0700”,“level”:“info”,“message”:“publishing check result”,“payload”:{“client”:“clientvm2.sensu.biz”,“check”:{“name”:“cron_check”,“issued”:1399399864,“command”:"/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",“executed”:1399400879,“output”:“CheckProcs CRITICAL: Found 0 matching processes; cmd /crond/\n”,“status”:2,“duration”:0.134}}}

Hi,

I configured sensu server as below.

In the server side
/etc/sensu/conf.d/check_cron.json
{
“checks”: {
“cron_check”: {
“handlers”: [“default”],
“command”: "/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",
“interval”: 60,
“subscribers”: [ “webservers” ]
}
}
}

and on the cilent side the client.json is as below and installed check-procs.rb in /etc/sensu/plugins on the client side.

{
“client”: {
“name”: “clientvm2.sensu.biz”,
“address”: “172.16.132.131”,
“subscriptions”: [ “test”, “webservers” ]

}
}

and restarted sensu server,api and sensu clients.

from the sensu-server.log on the server side I could find the server published the request

{“timestamp”:“2014-05-06T11:20:04.669414-0700”,“level”:“info”,“message”:“publishing check request”,“payload”:{“name”:“cron_check”,“issued”:1399400404,“command”:"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "},“subscribers”:[“webservers”]}

from the sensu-client.log on the client side, I could the see the request has been recieved from the server and the client processed the check-procs.rb and published the result that the crond service is not running.

“timestamp”:"2014-05-06T11:The problem is I was expecting the response in the server side logs as client published the result. I couldn’t see any response logs in the server side as client published the result of the script check-procs.rb

I could see only the below logs in the sensu-server.log on the server side
{“timestamp”:“2014-05-06T11:20:04.793113-0700”,“level”:“error”,“message”:“unknown handler”,“handler_name”:“default”}
{“timestamp”:“2014-05-06T11:20:04.871434-0700”,“level”:“error”,“message”:“unknown handler”,“handler_name”:“default”}

and on the dashboard there is a status " sh: /etc/sensu/plugins/check-procs.rb: No such file or directory" when the crond service is running on the client side. I haven’t put the check-procs.rb in the server side.

Could anyone let me know what was problem with the above configuration and how I can get the response of the client script that has been published?

Thanks,
Maha

{“timestamp”:“2014-05-06T11:20:04.793113-0700”,“level”:“error”,“message”:“unknown handler”,“handler_name”:“default”}

Jesse

···

On Tuesday, May 6, 2014 6:30:02 AM UTC-7, Mahalakshmi Rathinam wrote:

I am facing a similar issue, I have sensu version 0.16.0-1. And I am trying to install and make it work on Ubuntu 12.04.

~# ls -l /etc/sensu/plugins/check-procs.rb
-rwxr-xr-x 1 root root 8491 Nov 27 01:34 /etc/sensu/plugins/check-procs.rb

I am as well getting a similar warn message saying “unknown handler”

My “check definition” is /etc/sensu/conf.d/check_cron.json which contains –

{
“checks”: {
“cron_check”: {
“handlers”: [“default”],
“command”: "/etc/sensu/plugins/check-procs.rb -p cron -C 1 ",
“interval”: 60,
“subscribers”: [ “webservers” ]
}
}
}

However, this is what I get on the sensu-server.log

{“timestamp”:“2014-11-27T02:04:38.694460+0000”,“level”:“info”,“message”:“publishing check request”,“payload”:{“name”:“cron_check”,“issued”:1417053878,“command”:"/etc/sensu/plugins/check-procs.rb -p cron -C 1 "},“subscribers”:[“webservers”]}
{“timestamp”:“2014-11-27T02:04:56.738178+0000”,“level”:“info”,“message”:“pruning aggregations”}
{“timestamp”:“2014-11-27T02:05:06.708551+0000”,“level”:“info”,“message”:“determining stale clients”}
{“timestamp”:“2014-11-27T02:05:06.716808+0000”,“level”:“error”,“message”:“unknown handler”,“handler_name”:“default”}
{“timestamp”:“2014-11-27T02:05:06.719154+0000”,“level”:“error”,“message”:“unknown handler”,“handler_name”:“default”}
{“timestamp”:“2014-11-27T02:05:06.721317+0000”,“level”:“error”,“message”:“unknown handler”,“handler_name”:“default”}

and on sensu-client.log

{“timestamp”:“2014-11-27T02:04:38.696658+0000”,“level”:“info”,“message”:“received check request”,“check”:{“name”:“cron_check”,“issued”:1417053878,“command”:"/etc/sensu/plugins/check-procs.rb -p cron -C 1 “}}
{“timestamp”:“2014-11-27T02:04:38.760285+0000”,“level”:“info”,“message”:“publishing check result”,“payload”:{“client”:“sensu-server”,“check”:{“name”:“cron_check”,“issued”:1417053878,“command”:”/etc/sensu/plugins/check-procs.rb -p cron -C 1 “,“handlers”:[“default”],“interval”:60,“subscribers”:[“webservers”],“executed”:1417053878,“duration”:0.063,“output”:“CheckProcs OK: Found 1 matching processes; cmd /cron/\n”,“status”:0}}}
{“timestamp”:“2014-11-27T02:05:38.698365+0000”,“level”:“info”,“message”:“received check request”,“check”:{“name”:“cron_check”,“issued”:1417053938,“command”:”/etc/sensu/plugins/check-procs.rb -p cron -C 1 "}}

AS per the docs at http://sensuapp.org/docs/0.16/adding_a_check

I should be getting on server something like this…

···

===================================
INFO – : [publisher]
INFO – : [result]

ON Client

INFO – : [subscribe]

However what I am getting is (with exactly following whatever is there in the docs)

On server

publishing check request

On Client

received check request
publishing check result

What is wrong? is the docs old or the logs are wrong, or I am doing something wrongly?

On Tuesday, 6 May 2014 19:00:02 UTC+5:30, Mahalakshmi Rathinam wrote:

Hi,

    I configured sensu server as below.

In the server side
    /etc/sensu/conf.d/check_cron.json
    {
  "checks": {
    "cron_check": {
      "handlers": ["default"],
      "command": "/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",
      "interval": 60,
      "subscribers": [ "webservers" ]
    }
  }
}

and on the cilent side the client.json is as below and installed check-procs.rb in /etc/sensu/plugins on the client side.

{
  "client": {
    "name": "clientvm2.sensu.biz",
    "address": "172.16.132.131",
    "subscriptions": [ "test", "webservers" ]
  }
}

and restarted sensu server,api and sensu clients.

from the sensu-server.log on the server side I could find the server published the request

{"timestamp":"2014-05-06T11:20:04.669414-0700","level":"info","message":"publishing check request","payload":{"name":"cron_check","issued":1399400404,"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "},"subscribers":["webservers"]}

from the sensu-client.log on the client side, I could the see the request has been recieved from the server and the client processed the check-procs.rb  and published the result that the crond service is not running.

"timestamp":"2014-05-06T11:
27:59.099184-0700","level":"info","message":"received check request","check":{"name":"cron_check","issued":1399399864,"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "}}
{"timestamp":"2014-05-06T11:27:59.234294-0700","level":"info","message":"publishing check result","payload":{"client":"clientvm2.sensu.biz","check":{"name":"cron_check","issued":1399399864,"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 ","executed":1399400879,"output":"CheckProcs CRITICAL: Found 0 matching processes; cmd /crond/\n","status":2,"duration":0.134}}}

The problem is I was expecting the response in the server side logs as client published the result. I couldn't see any response logs in the server side as client published the result of the script check-procs.rb

I could see only the below logs in the sensu-server.log on the server side
{"timestamp":"2014-05-06T11:20:04.793113-0700","level":"error","message":"unknown handler","handler_name":"default"}
{"timestamp":"2014-05-06T11:20:04.871434-0700","level":"error","message":"unknown handler","handler_name":"default"}

and on the dashboard there is a status " sh: /etc/sensu/plugins/check-procs.rb: No such file or directory" when the crond service is running on the client side. I haven't put the check-procs.rb in the server side.

Could anyone let me know what was problem with the above configuration and how I can get the response of the client script that has been published?

Thanks,
Maha

The issue here is that a handler named "default" is not defined, per
the error message you pasted:
{"timestamp":"2014-11-27T02:05:06.721317+0000","level":"error","message":"unknown
handler","handler_name":"default"}

The docs say that a "default" handler is defined that just puts out
the json, but I can't find that code, I'm skeptical.

You are ready to setup a handler:
http://sensuapp.org/docs/0.16/handlers

Arguably the docs are out of order any maybe a handler should be setup first?

···

On Wed, Nov 26, 2014 at 6:16 PM, Sanjay Upadhyay <saneax@gmail.com> wrote:

I am facing a similar issue, I have sensu version 0.16.0-1. And I am trying
to install and make it work on Ubuntu 12.04.

~# ls -l /etc/sensu/plugins/check-procs.rb
-rwxr-xr-x 1 root root 8491 Nov 27 01:34 /etc/sensu/plugins/check-procs.rb

I am as well getting a similar warn message saying "unknown handler"

My "check definition" is /etc/sensu/conf.d/check_cron.json which contains --

{
  "checks": {
    "cron_check": {
      "handlers": ["default"],
      "command": "/etc/sensu/plugins/check-procs.rb -p cron -C 1 ",
      "interval": 60,
      "subscribers": [ "webservers" ]
    }
  }
}

However, this is what I get on the sensu-server.log

{"timestamp":"2014-11-27T02:04:38.694460+0000","level":"info","message":"publishing
check
request","payload":{"name":"cron_check","issued":1417053878,"command":"/etc/sensu/plugins/check-procs.rb
-p cron -C 1 "},"subscribers":["webservers"]}
{"timestamp":"2014-11-27T02:04:56.738178+0000","level":"info","message":"pruning
aggregations"}
{"timestamp":"2014-11-27T02:05:06.708551+0000","level":"info","message":"determining
stale clients"}
{"timestamp":"2014-11-27T02:05:06.716808+0000","level":"error","message":"unknown
handler","handler_name":"default"}
{"timestamp":"2014-11-27T02:05:06.719154+0000","level":"error","message":"unknown
handler","handler_name":"default"}
{"timestamp":"2014-11-27T02:05:06.721317+0000","level":"error","message":"unknown
handler","handler_name":"default"}

and on sensu-client.log

{"timestamp":"2014-11-27T02:04:38.696658+0000","level":"info","message":"received
check
request","check":{"name":"cron_check","issued":1417053878,"command":"/etc/sensu/plugins/check-procs.rb
-p cron -C 1 "}}
{"timestamp":"2014-11-27T02:04:38.760285+0000","level":"info","message":"publishing
check
result","payload":{"client":"sensu-server","check":{"name":"cron_check","issued":1417053878,"command":"/etc/sensu/plugins/check-procs.rb
-p cron -C 1
","handlers":["default"],"interval":60,"subscribers":["webservers"],"executed":1417053878,"duration":0.063,"output":"CheckProcs
OK: Found 1 matching processes; cmd /cron/\n","status":0}}}
{"timestamp":"2014-11-27T02:05:38.698365+0000","level":"info","message":"received
check
request","check":{"name":"cron_check","issued":1417053938,"command":"/etc/sensu/plugins/check-procs.rb
-p cron -C 1 "}}

AS per the docs at http://sensuapp.org/docs/0.16/adding_a_check

I should be getting on server something like this..

INFO -- : [publisher]
INFO -- : [result]

ON Client

INFO -- : [subscribe]

However what I am getting is (with exactly following whatever is there in
the docs)

On server

publishing check request

On Client

received check request
publishing check result

What is wrong? is the docs old or the logs are wrong, or I am doing
something wrongly?

On Tuesday, 6 May 2014 19:00:02 UTC+5:30, Mahalakshmi Rathinam wrote:

    Hi,

        I configured sensu server as below.

    In the server side
        /etc/sensu/conf.d/check_cron.json
        {
      "checks": {
        "cron_check": {
          "handlers": ["default"],
          "command": "/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",
          "interval": 60,
          "subscribers": [ "webservers" ]
        }
      }
    }

    and on the cilent side the client.json is as below and installed
check-procs.rb in /etc/sensu/plugins on the client side.

    {
      "client": {
        "name": "clientvm2.sensu.biz",
        "address": "172.16.132.131",
        "subscriptions": [ "test", "webservers" ]
      }
    }

    and restarted sensu server,api and sensu clients.

    from the sensu-server.log on the server side I could find the server
published the request

{"timestamp":"2014-05-06T11:20:04.669414-0700","level":"info","message":"publishing
check
request","payload":{"name":"cron_check","issued":1399400404,"command":"/etc/sensu/plugins/check-procs.rb
-p crond -C 1 "},"subscribers":["webservers"]}

    from the sensu-client.log on the client side, I could the see the
request has been recieved from the server and the client processed the
check-procs.rb and published the result that the crond service is not
running.

    "timestamp":"2014-05-06T11:
    27:59.099184-0700","level":"info","message":"received check
request","check":{"name":"cron_check","issued":1399399864,"command":"/etc/sensu/plugins/check-procs.rb
-p crond -C 1 "}}

{"timestamp":"2014-05-06T11:27:59.234294-0700","level":"info","message":"publishing
check
result","payload":{"client":"clientvm2.sensu.biz","check":{"name":"cron_check","issued":1399399864,"command":"/etc/sensu/plugins/check-procs.rb
-p crond -C 1 ","executed":1399400879,"output":"CheckProcs CRITICAL: Found 0
matching processes; cmd /crond/\n","status":2,"duration":0.134}}}

    The problem is I was expecting the response in the server side logs as
client published the result. I couldn't see any response logs in the server
side as client published the result of the script check-procs.rb

    I could see only the below logs in the sensu-server.log on the server
side

{"timestamp":"2014-05-06T11:20:04.793113-0700","level":"error","message":"unknown
handler","handler_name":"default"}

{"timestamp":"2014-05-06T11:20:04.871434-0700","level":"error","message":"unknown
handler","handler_name":"default"}

    and on the dashboard there is a status " sh:
/etc/sensu/plugins/check-procs.rb: No such file or directory" when the crond
service is running on the client side. I haven't put the check-procs.rb in
the server side.

    Could anyone let me know what was problem with the above configuration
and how I can get the response of the client script that has been published?

    Thanks,
    Maha