sensu-plugins-process-checks
sensu-plugins-process-checks copied to clipboard
Allow non-root user to run metrics-per-process.py
In my set-up (Ubuntu server 16.04), some of the files in /proc/<PID>/*
can be read only by root. This is annoying because:
- I actually don't care about these metrics
- This prevents the whole check to run
- I don't want the sensu-client to run as root.
As a temporary solution, I deployed a copy of metrics-per-process.py
where I commented out the calls that fail. Now I am wondering what would be a better solution. I am happy to contribute, but wanted to check with you what's the best approach. I can think of:
- Have a switch to turn off the metrics that are typically restricted to root. This assumes there is such a typical set, which I am not sure of at all, and also has the drawback of not solving the problem for non-typical set-ups
- Catch the error when a metric fails, and skip it instead of aborting the whole check.
- Have a regex option to filter the list of metrics to return.
The last two could be combined.
What do you think?