linfo icon indicating copy to clipboard operation
linfo copied to clipboard

Handle services when their executable paths are not availabe

Open ElTopo opened this issue 6 years ago • 1 comments

Hello,

I have some services I want to monitor but their executable paths are not available (they show up in 'ps' command as "[cmd]" with square brackets) and they don't have pid files..

One example is "[mega-cmd-server]" from MEGAcmd https://github.com/meganz/MEGAcmd

Currently $settings['services']['executables'] array only takes full path of the executable:

// Format: Label => path to executable or array containing arguments to be checked
$settings['services']['executables'] = array(
    // 'MySQLd' => '/usr/sbin/mysqld' // uncomment to enable
    // 'BuildSlave' => array('/usr/bin/python', // executable
    //                      1 => '/usr/local/bin/buildslave') // argv[1]
);

Is it possible for settings array to handle services running as "[cmd]" in 'ps'?

see: https://unix.stackexchange.com/questions/22121/what-do-the-brackets-around-processes-mean

ElTopo avatar Nov 09 '19 18:11 ElTopo

The proper fix for this would be to make linfo, rather than going off of /proc/$pid/cmdline, to grab the file path from /proc/$pid/exe instead, which would use the underlying file path, in your case the actual path your mega-cmd-server uses.

jrgp avatar Jan 09 '20 23:01 jrgp