File checks doesnt work

Hi,

I have put a file check using the community plugin.
https://github.com/sensu/sensu-community-plugins/tree/master/plugins/files

It works fine when I execute it manually on the agent machine but doesn’t execute via the sensu monitor. I get an error stating file not found. I’m I missing something?

{

“checks”: {

“check_webserver_log”: {

“handlers”: [“default”],

“command”: “/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -p Error”,

“interval”: 60,

“subscribers”: [ “webservers” ]

}

}

}

Also this plugin doesn’t support searching a pattern anywhere in the file. I only searches for the starting of the string. Any suggestions?

Thanks,

Mani

The plugin should support matching any pattern in the *last* line of the file:
https://github.com/sensu/sensu-community-plugins/blob/master/plugins/files/check-tail.rb#L58-L64

Can you paste the error message you are getting verbatim? And what is
giving that error message? (which sensu log)

···

On Mon, Sep 1, 2014 at 5:59 AM, reachmani <reachmani@gmail.com> wrote:

Hi,

I have put a file check using the community plugin.
https://github.com/sensu/sensu-community-plugins/tree/master/plugins/files

It works fine when I execute it manually on the agent machine but doesn't
execute via the sensu monitor. I get an error stating file not found. I'm I
missing something?

{
  "checks": {
    "check_webserver_log": {
      "handlers": ["default"],
      "command": "/opt/sensu/embedded/bin/ruby
/etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -p Error",
      "interval": 60,
     "subscribers": [ "webservers" ]
    }
  }
}

Also this plugin doesn't support searching a pattern anywhere in the file. I
only searches for the starting of the string. Any suggestions?

Thanks,
Mani

There are no errors in monitor or in agent. I see below error in Uchiwa GUI.

output

Tail CRITICAL: File not found

Also I changed the check script to match the pattern in the last 100 lines. Here is the updated script.

/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/\server.log -P Error -l 1000

Thanks,

Mani

···

On Monday, 1 September 2014 22:30:16 UTC+5:30, Kyle Anderson wrote:

The plugin should support matching any pattern in the last line of the file:
https://github.com/sensu/sensu-community-plugins/blob/master/plugins/files/check-tail.rb#L58-L64

http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-i-match

Can you paste the error message you are getting verbatim? And what is
giving that error message? (which sensu log)

On Mon, Sep 1, 2014 at 5:59 AM, reachmani reac...@gmail.com wrote:

Hi,

I have put a file check using the community plugin.
https://github.com/sensu/sensu-community-plugins/tree/master/plugins/files

It works fine when I execute it manually on the agent machine but doesn’t
execute via the sensu monitor. I get an error stating file not found. I’m I
missing something?

{
“checks”: {
“check_webserver_log”: {
“handlers”: [“default”],
“command”: “/opt/sensu/embedded/bin/ruby
/etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -p Error”,
“interval”: 60,
“subscribers”: [ “webservers” ]
}
}
}

Also this plugin doesn’t support searching a pattern anywhere in the file. I
only searches for the starting of the string. Any suggestions?

Thanks,
Mani

I also ran agent in debug mode, here is the log file.
sensu-client.log

{“timestamp”:“2014-09-02T04:35:36.904666+0000”,“level”:“debug”,“message”:“publishing keepalive”,“payload”:{“name”:“P_WEBSERVER02”,“address”:“10.0.0.32”,“subscriptions”:[“generic”,“webservers”],“version”:“0.13.1”,“timestamp”:1409632536}}

{“timestamp”:“2014-09-02T04:35:36.904859+0000”,“level”:“debug”,“message”:“subscribing to client subscriptions”}

{“timestamp”:“2014-09-02T04:35:36.904915+0000”,“level”:“debug”,“message”:“subscribing to a subscription”,“subscription”:“generic”}

{“timestamp”:“2014-09-02T04:35:36.905046+0000”,“level”:“debug”,“message”:“subscribing to a subscription”,“subscription”:“webservers”}

{“timestamp”:“2014-09-02T04:35:36.905135+0000”,“level”:“debug”,“message”:“scheduling standalone checks”}

{“timestamp”:“2014-09-02T04:35:36.905229+0000”,“level”:“debug”,“message”:“binding client tcp and udp sockets”,“options”:{“bind”:“127.0.0.1”,“port”:3030}}

{“timestamp”:“2014-09-02T04:35:56.905114+0000”,“level”:“debug”,“message”:“publishing keepalive”,“payload”:{“name”:“P_WEBSERVER02”,“address”:“10.0.0.32”,“subscriptions”:[“generic”,“webservers”],“version”:“0.13.1”,“timestamp”:1409632556}}

{“timestamp”:“2014-09-02T04:36:16.906084+0000”,“level”:“debug”,“message”:“publishing keepalive”,“payload”:{“name”:“P_WEBSERVER02”,“address”:“10.0.0.32”,“subscriptions”:[“generic”,“webservers”],“version”:“0.13.1”,“timestamp”:1409632576}}

{“timestamp”:“2014-09-02T04:36:26.825835+0000”,“level”:“info”,“message”:“received check request”,“check”:{“name”:“check_webserver_log”,“issued”:1409632586,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -P Error -l 1000”}}

{“timestamp”:“2014-09-02T04:36:26.826019+0000”,“level”:“debug”,“message”:“processing check”,“check”:{“name”:“check_webserver_log”,“issued”:1409632586,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -P Error -l 1000”}}

{“timestamp”:“2014-09-02T04:36:26.826093+0000”,“level”:“debug”,“message”:“attempting to execute check command”,“check”:{“name”:“check_webserver_log”,“issued”:1409632586,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -P Error -l 1000”}}

{“timestamp”:“2014-09-02T04:36:27.024157+0000”,“level”:“info”,“message”:“publishing check result”,“payload”:{“client”:“P_WEBSERVER02”,“check”:{“name”:“check_webserver_log”,“issued”:1409632586,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -P Error -l 1000”,“executed”:1409632586,“duration”:0.198,“output”:“Tail CRITICAL: File not found\n”,“status”:2}}}

{“timestamp”:“2014-09-02T04:36:34.833509+0000”,“level”:“info”,“message”:“received check request”,“check”:{“name”:“check_node_proc”,“issued”:1409632594,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-procs.rb -p server.js -C 4”}}

{“timestamp”:“2014-09-02T04:36:34.833674+0000”,“level”:“debug”,“message”:“processing check”,“check”:{“name”:“check_node_proc”,“issued”:1409632594,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-procs.rb -p server.js -C 4”}}

{“timestamp”:“2014-09-02T04:36:34.833773+0000”,“level”:“debug”,“message”:“attempting to execute check command”,“check”:{“name”:“check_node_proc”,“issued”:1409632594,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-procs.rb -p server.js -C 4”}}

{“timestamp”:“2014-09-02T04:36:34.965420+0000”,“level”:“info”,“message”:“publishing check result”,“payload”:{“client”:“P_WEBSERVER02”,“check”:{“name”:“check_node_proc”,“issued”:1409632594,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-procs.rb -p server.js -C 4”,“executed”:1409632594,“duration”:0.131,“output”:“CheckProcs OK: Found 4 matching processes; cmd /server.js/\n”,“status”:0}}}

{“timestamp”:“2014-09-02T04:36:36.907598+0000”,“level”:“debug”,“message”:“publishing keepalive”,“payload”:{“name”:“P_WEBSERVER02”,“address”:“10.0.0.32”,“subscriptions”:[“generic”,“webservers”],“version”:“0.13.1”,“timestamp”:1409632596}}

{“timestamp”:“2014-09-02T04:36:56.909061+0000”,“level”:“debug”,“message”:“publishing keepalive”,“payload”:{“name”:“P_WEBSERVER02”,“address”:“10.0.0.32”,“subscriptions”:[“generic”,“webservers”],“version”:“0.13.1”,“timestamp”:1409632616}}

{“timestamp”:“2014-09-02T04:37:16.910777+0000”,“level”:“debug”,“message”:“publishing keepalive”,“payload”:{“name”:“P_WEBSERVER02”,“address”:“10.0.0.32”,“subscriptions”:[“generic”,“webservers”],“version”:“0.13.1”,“timestamp”:1409632636}}

{“timestamp”:“2014-09-02T04:37:26.826325+0000”,“level”:“info”,“message”:“received check request”,“check”:{“name”:“check_webserver_log”,“issued”:1409632646,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -P Error -l 1000”}}

{“timestamp”:“2014-09-02T04:37:26.826488+0000”,“level”:“debug”,“message”:“processing check”,“check”:{“name”:“check_webserver_log”,“issued”:1409632646,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -P Error -l 1000”}}

{“timestamp”:“2014-09-02T04:37:26.826580+0000”,“level”:“debug”,“message”:“attempting to execute check command”,“check”:{“name”:“check_webserver_log”,“issued”:1409632646,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -P Error -l 1000”}}

{“timestamp”:“2014-09-02T04:37:26.958314+0000”,“level”:“info”,“message”:“publishing check result”,“payload”:{“client”:“P_WEBSERVER02”,“check”:{“name”:“check_webserver_log”,“issued”:1409632646,“command”:“/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -P Error -l 1000”,“executed”:1409632646,“duration”:0.132,“output”:“Tail CRITICAL: File not found\n”,“status”:2}}}

Check executed manually

/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -P Error -l 1000

Tail OK: No matches found

Linux command output on the log file

ls -lt /home/ec2-user/server.log

-rw-rw-r-- 1 ec2-user ec2-user 18579008 Sep 2 04:38 /home/ec2-user/server.log

I am puzzled.

Thanks,

Mani

···

On Tuesday, 2 September 2014 10:00:30 UTC+5:30, reachmani wrote:

There are no errors in monitor or in agent. I see below error in Uchiwa GUI.

output

Tail CRITICAL: File not found

Also I changed the check script to match the pattern in the last 100 lines. Here is the updated script.

/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/\server.log -P Error -l 1000

Thanks,

Mani

On Monday, 1 September 2014 22:30:16 UTC+5:30, Kyle Anderson wrote:

The plugin should support matching any pattern in the last line of the file:
https://github.com/sensu/sensu-community-plugins/blob/master/plugins/files/check-tail.rb#L58-L64

http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-i-match

Can you paste the error message you are getting verbatim? And what is
giving that error message? (which sensu log)

On Mon, Sep 1, 2014 at 5:59 AM, reachmani reac...@gmail.com wrote:

Hi,

I have put a file check using the community plugin.
https://github.com/sensu/sensu-community-plugins/tree/master/plugins/files

It works fine when I execute it manually on the agent machine but doesn’t
execute via the sensu monitor. I get an error stating file not found. I’m I
missing something?

{
“checks”: {
“check_webserver_log”: {
“handlers”: [“default”],
“command”: “/opt/sensu/embedded/bin/ruby
/etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -p Error”,
“interval”: 60,
“subscribers”: [ “webservers” ]
}
}
}

Also this plugin doesn’t support searching a pattern anywhere in the file. I
only searches for the starting of the string. Any suggestions?

Thanks,
Mani

Figured out the problem, it was to do with folder permission.

Thanks,

Mani

···

On Monday, 1 September 2014 18:29:09 UTC+5:30, reachmani wrote:

Hi,

I have put a file check using the community plugin.
https://github.com/sensu/sensu-community-plugins/tree/master/plugins/files

It works fine when I execute it manually on the agent machine but doesn’t execute via the sensu monitor. I get an error stating file not found. I’m I missing something?

{

“checks”: {

“check_webserver_log”: {

“handlers”: [“default”],

“command”: “/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -p Error”,

“interval”: 60,

“subscribers”: [ “webservers” ]

}

}

}

Also this plugin doesn’t support searching a pattern anywhere in the file. I only searches for the starting of the string. Any suggestions?

Thanks,

Mani

I think Sensu comes from the Japanese name for a folding fan made from bamboo and paper, which represent the Fanout exchange concept utilized by the AMQP (protocol). The Sensu framework provides foundation for monitoring cloud infrastructure and applications. Fully extensible via source code, with active community.

···

Rugged Phone | Rugged Android Phone

On Monday, September 1, 2014 10:00:16 PM UTC+5, Kyle Anderson wrote:

The plugin should support matching any pattern in the last line of the file:
https://github.com/sensu/sensu-community-plugins/blob/master/plugins/files/check-tail.rb#L58-L64

http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-i-
timeli0e
match

Can you paste the error message you are getting verbatim? And what is
giving that error message? (which sensu log)

On Mon, Sep 1, 2014 at 5:59 AM, reachmani reac...@gmail.com wrote:

Hi,

I have put a file check using the community plugin.
https://github.com/sensu/sensu-community-plugins/tree/master/plugins/files

It works fine when I execute it manually on the agent machine but doesn’t
execute via the sensu monitor. I get an error stating file not found. I’m I
missing something?

{
“checks”: {
“check_webserver_log”: {
“handlers”: [“default”],
“command”: “/opt/sensu/embedded/bin/ruby
/etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -p Error”,
“interval”: 60,
“subscribers”: [ “webservers” ]
}
}
}

Also this plugin doesn’t support searching a pattern anywhere in the file. I
only searches for the starting of the string. Any suggestions?

Thanks,
Mani

I think Sensu comes from the Japanese name for a folding fan made from bamboo and paper, which represent the Fanout exchange concept utilized by the AMQP (protocol). The Sensu framework provides foundation for monitoring cloud infrastructure and applications. Fully extensible via source code, with active community.

···

Rugged Phone | Rugged Android Phone

On Monday, September 1, 2014 10:00:16 PM UTC+5, Kyle Anderson wrote:

The plugin should support matching any pattern in the last line of the file:
https://github.com/sensu/sensu-community-plugins/blob/master/plugins/files/check-tail.rb#L58-L64

http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-i-
timeli0e
match

Can you paste the error message you are getting verbatim? And what is
giving that error message? (which sensu log)

On Mon, Sep 1, 2014 at 5:59 AM, reachmani reac...@gmail.com wrote:

Hi,

I have put a file check using the community plugin.
https://github.com/sensu/sensu-community-plugins/tree/master/plugins/files

It works fine when I execute it manually on the agent machine but doesn’t
execute via the sensu monitor. I get an error stating file not found. I’m I
missing something?

{
“checks”: {
“check_webserver_log”: {
“handlers”: [“default”],
“command”: “/opt/sensu/embedded/bin/ruby
/etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -p Error”,
“interval”: 60,
“subscribers”: [ “webservers” ]
}
}
}

Also this plugin doesn’t support searching a pattern anywhere in the file. I
only searches for the starting of the string. Any suggestions?

Thanks,
Mani

I think Sensu comes from the Japanese name for a folding fan made from bamboo and paper, which represent the Fanout exchange concept utilized by the AMQP (protocol). The Sensu framework provides foundation for monitoring cloud infrastructure and applications. Fully extensible via source code, with active community.

···

Rugged Phone | Rugged Android Phone

On Monday, September 1, 2014 10:00:16 PM UTC+5, Kyle Anderson wrote:

The plugin should support matching any pattern in the last line of the file:
https://github.com/sensu/sensu-community-plugins/blob/master/plugins/files/check-tail.rb#L58-L64

http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-i-
timeli0e
match

Can you paste the error message you are getting verbatim? And what is
giving that error message? (which sensu log)

On Mon, Sep 1, 2014 at 5:59 AM, reachmani reac...@gmail.com wrote:

Hi,

I have put a file check using the community plugin.
https://github.com/sensu/sensu-community-plugins/tree/master/plugins/files

It works fine when I execute it manually on the agent machine but doesn’t
execute via the sensu monitor. I get an error stating file not found. I’m I
missing something?

{
“checks”: {
“check_webserver_log”: {
“handlers”: [“default”],
“command”: “/opt/sensu/embedded/bin/ruby
/etc/sensu/plugins/check-tail.rb -f /home/ec2-user/server.log -p Error”,
“interval”: 60,
“subscribers”: [ “webservers” ]
}
}
}

Also this plugin doesn’t support searching a pattern anywhere in the file. I
only searches for the starting of the string. Any suggestions?

Thanks,
Mani