sensu-plugins / sensu-plugin

A framework for writing Sensu plugins & handlers with Ruby.
http://sensuapp.org
MIT License
126 stars 117 forks source link

Sensu plugin logger #183

Closed makaveli0129 closed 6 years ago

makaveli0129 commented 6 years ago

With the plugin CLI i am trying to use the "logger" in the same way that we do for extensions but i keep getting errors that Sensu::Logger.get is not valid. I'm assuming i am doing something wrong but could not find an example of a plugin that uses the sensu-client logger. Is there a way to do this?

majormoses commented 6 years ago

do you have a require for this? https://github.com/sensu/sensu-extension/blob/master/lib/sensu/extension.rb there is no similar logger I see for plugin.

cwjohnston commented 6 years ago

Because extensions run inside the EventMachine loop, they have access to the logger. Plugins run as a child process so they do not have access to the logger. Output for both check and handler plugins should be sent to stdout so that Sensu can capture and log it.

cwjohnston commented 6 years ago

I don't think there's anything we can do for this request for the reasons described above. Closing.