我正在尝试使用check_procs
NRPE 来查明乘客正在我的服务器上运行。它从加载httpd
但单独显示。
32135 ? Sl 0:09 Passenger RackApp: /usr/share/puppet/rack/puppetmasterd
32589 ? Sl 0:01 Passenger AppPreloader: /usr/share/puppet/rack/puppetmasterd
32629 ? Sl 0:05 Passenger RackApp: /usr/share/puppet/rack/puppetmasterd
32751 ? Sl 0:05 Passenger RackApp: /usr/share/puppet/rack/puppetmasterd
当我尝试像这样测试它时:
check_procs -w 2: -c 3: -C Passenger
它告诉我找到了 0 个进程。我看到了它们 - 我该如何让 NRPE 计算它们的数量?
答案1
进程名称可能不是您所想的那样。要了解进程如何check_process
查找您的工作,请尝试以下操作:check_procs -vv -C Passenger
。您将看到类似以下内容:
/usr/lib64/nagios/plugins/check_procs -vv -C Passenger
CMD: /bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args'
PROCS OK: 0 processes with command name 'Passenger'
现在接受ps
命令并自己尝试一下,如下所示:
/bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args' | grep Passenger
请注意,有很多工作符合您的描述......只是名称不像您想象的那样......
S+ 0 841 26063 103244 852 0.0 grep grep Passenger
Ssl 0 30160 2134 216524 1972 0.0 PassengerWatchd PassengerWatchdog
Sl 0 30164 30160 1108096 4980 0.2 PassengerHelper PassengerHelperAgent
Sl 99 30170 30160 219616 4292 0.0 PassengerLoggin PassengerLoggingAgent
Sl 52 32135 1 217972 113944 1.1 ruby Passenger RackApp: /usr/share/puppet/rack/puppetmasterd
Sl 52 32629 1 235484 131480 1.9 ruby Passenger RackApp: /usr/share/puppet/rack/puppetmasterd
Sl 52 32751 1 218672 114568 1.7 ruby Passenger RackApp: /usr/share/puppet/rack/puppetmasterd
现在更改您的check_procs
命令以匹配:
/usr/lib64/nagios/plugins/check_procs -C ruby -a Passenger
PROCS OK: 3 processes with command name 'ruby', args 'Passenger'