Permission problems when use check_log.rb

I’d like to use check_log.rb from plugins/logging in sensu-community-plugins. This check plugin runs well when I executed it from the terminal. However, when I add it into Sensu to check MySQL log, I got this problem here:
CheckLog UNKNOWN: Could not open log file: Permission denied - /var/log/mysql/error.log

and, here is my check definition on Sensu server:

{
“checks”: {
“check_log”: {
“handlers”: [“print_timestamp”],
“command”: “/etc/sensu/plugins/check-log.rb -f /var/log/mysql/error.log -q ‘\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} \d{4} \[Warning\] .*’ -r”,
“interval”: 10,
“subscribers”: [ “webservers” ]
}
}
}

I wondered how can I fix this problem. I’d also like to know what user Sensu Client use to run, as well as, why does this problem occur?

Like any monitoring tool, Sensu must have permission to monitor the things.

You can fix the problem by giving the sensu user read-permission on
that file. (and make sure it can enter/execute the /var/lib/mysql dir)

···

On Tue, Mar 31, 2015 at 7:04 PM, Timothy John <tim_john@126.com> wrote:

I'd like to use check_log.rb from plugins/logging in
sensu-community-plugins. This check plugin runs well when I executed it from
the terminal. However, when I add it into Sensu to check MySQL log, I got
this problem here:
CheckLog UNKNOWN: Could not open log file: Permission denied -
/var/log/mysql/error.log

and, here is my check definition on Sensu server:

{
  "checks": {
    "check_log": {
      "handlers": ["print_timestamp"],
      "command": "/etc/sensu/plugins/check-log.rb -f
/var/log/mysql/error.log -q '\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}
\\d{4} \\[Warning\\] .*' -r",
      "interval": 10,
      "subscribers": [ "webservers" ]
    }
  }
}

I wondered how can I fix this problem. I'd also like to know what user Sensu
Client use to run, as well as, why does this problem occur?