sensu-plugin-python
sensu-plugin-python copied to clipboard
accessing custom plugin settings
In ruby framework, I can create custom settings like,
{
"my_custom_plugin": {
"foo": true,
"bar": false
}
}
and access them in plugin,
def foo_enabled?
settings['my_custom_plugin']['foo']
end
how can it be done in python framework?
Found it in the code. for anyone interested,
import utils from sensu_plugin package,
from sensu_plugin import utils
and access settings using get_settings(),
utils.get_settings()['my_custom_plugin']['foo']
I'm going to reopen this with the intention of replicating the way this works in Ruby and making the settings available in the plugin base class.