Ad Widget

Collapse

Using sudo in a user parameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mellis
    Senior Member
    • Oct 2017
    • 145

    #1

    Using sudo in a user parameter

    I am running zabbix 4.2.1

    I am setting up a custom monitor that I have to script under sudo to root to monitor a pacemaker HA cluster. I want to run the command crm_mon --as-xml to get an xml output that I can then parse for several status values from the output.

    I created a pacemaker.conf that contains: UserParameter=pacemaker.status, sudo /usr/sbin/crm_mon --as-xml
    I also created a pacemaker.sudoers that has
    zabbix ALL=NOPASSWD: /usr/sbin/crm_mon --as-xml for the /etc/sudoers.d folder

    When I the add the item that has the key pacemaker.status I get a warning message from the OS not the xml I was expecting.
    I did disabled the selinux.

    I found I could add the line

    Defaults:zabbix !lecture to the /etc/sudoers file and that disabled the lecture. I am still getting a message sudo: no tty present and no askpass program specified Anyone have an idea how to clean this up?
Working...