Running Plugin as Root

Hello All

By default the agent runs the plugin as icinga user. I want to run the plugin with specific user. For example check_disk should run as root. On the same server I want to run check_db2_health with db2inst1 user.

Root for disk : because I can read some readonly disk which icinga user cannot read
db2inst1: because I do not need password locally to login on the same server

Is there anyway we can achieve this?

What changes I can make

You can specify that the command should run with sudo

https://icinga.com/docs/icinga2/latest/doc/22-selinux/#running-plugins-requiring-sudo

1 Like

Thank You. I am sure will somehow reach there of exactly what I want to do

  1. Where in icinga director I can mention this. Sorry couldn’t see this option anywhere for a check_disk single service on a particular server (i will prefer to override for a particular server)
  2. How do I run a plugin using other user like lets say db2inst1
  3. Can I make the agent run through non icinga user somehow. Can it run multi-instance (1 using icinga user / another using db2inst1 user)

Hello there!
I will move this topic to the service monitoring category, where it fits better. :slight_smile:
I don’t know the answers to your questions, but I hope someone there will!

Maybe it would also help if you posted your questions from your comment into separate topics, so they gain a little more visibility (don’t be afraid to open multiple topics!)

Have a nice day,
Feu

Hello
I added the following in Director on overriding a particular server on which I want to implement sudo command for check_disk


vars like like below

But inspect has no change its as before

All Right

This is what works.

I want to replace /usr/lib64/nagios/plugins/ using PluginDir +
Is that possible? The reason behind is obviously different flavor of linux has different plugin directory like Suse has /usr/lib/nagios/plugins/ and RHEL has /usr/lib64/nagios/plugins