telegraf: passenger-status path and sudo add-on missing.

Relevant telegraf.conf:

[[inputs.passenger]]
  command = "sudo passenger-status -v --show=xml"

System info:

Centos6 telegraf-1.10.1-1.x86_64

Issue:

User telegraf is a member of the sudoers and on its own is able to execute the command ( from shell ) :

sudo passenger-status -v --show=xml # with the correct xml output.

however with the original configuration as on the telegraf.conf above the telegraf log returns:

2019-03-25T09:51:50Z E! [inputs.passenger]: Error in plugin: exec: "passenger-status": executable file not found in $PATH
2019-03-25T09:51:50Z E! Error in plugin [inputs.passenger]: exec: "passenger-status": executable file not found in $PATH

while setting the configuration to : command = “sudo passenger-status -v --show=xml” returs:

2019-03-25T09:54:20Z E! Error in plugin [inputs.passenger]: exec: "passenger-status": executable file not found in $PATH
2019-03-25T09:54:20Z E! [inputs.passenger]: Error in plugin: exit status 1
setting the full path inb the command , eg : command=“/usr/bin/sudo /opt/ruby/bin/passenger-status -v --show=xml” still returns the :
2019-03-25T10:00:30Z E! Error in plugin [inputs.passenger]: exec: "passenger-status": executable file not found in $PATH
2019-03-25T10:00:30Z E! [inputs.passenger]: Error in plugin: exit status 1
the config describers the passenger input path

but the variable path also returns errors as not known variable when defined:

2019-03-25T10:03:08Z E! [telegraf] Error running agent: Error parsing /etc/telegraf/telegraf.conf, line 24: field corresponding to `path' is not defined in `*passenger.passenger'

can the configuration be expanded into adding sudo and corrected to be able to parse the correct path?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (9 by maintainers)

Most upvoted comments

The requiretty default totally seems to be the issue. Adding the following to a sudoers file got the passenger plugin to work as expected:

telegraf   ALL=(root)    NOPASSWD:/path/to/passenger-status
Defaults!/path/to/passenger-status !requiretty

Similarly, I could’ve just removed the requiretty default and that should’ve achieved the same thing.