Closed penguin02007 closed 6 years ago
Hi. The discover mode output should look like the one you posted - process discovery is only for finding out what processes you have defined/available in pm2
, not what their momentary state is.
Regarding monitor mode - are you seeing any errors? Are you getting something resembling the following?
[ OK ] Periodic sending of process list succeeded
[ OK ] Periodic sending of PM2 status succeeded
I'll add some debugging options in a moment and make a branch that should shed some light on the issue. Going to implement much-needed logging, finally.
Correct. Sincediscover
didn't see it, I assume it won't matter if I test it with monitor
.
There are errors but I think it is related to sending the items to zabbix server and unrelated to the problem I am having.
* Client running (monitor mode: on)
[ ERR ] Periodic sending of PM2 status failed: { Error: ENOENT: no such file or directory, open '/home/foo/etc/data/hypernova/pm2/pm2.pid'
at Error (native)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/etc/data/hypernova/pm2/pm2.pid' }
[ ERR ] Periodic sending of process list error: { Error: Command failed: /usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -
at ChildProcess.exithandler (child_process.js:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
killed: false,
code: 2,
signal: null,
cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -' }
Okay, there are essentially two independent errors above:
ENOENT
- our script can't find pm2.pid
for some reason - wrong path? (What is your PM2_HOME
? Where should pm2-zabbix be looking for the pidfile?)zabbix_sender
exit code 2 - this means some values were discarded by the server. Have you checked the troubleshooting guide in the README
? Usually this means that the data items are not matching any keys on the server side (for example, the hostname is wrong).Sorry I was away yesterday. PM2_HOME is under a different directory. pm2.pid lives under /etc/data/hypernova/pm2/pm2.pid' instead of my home directory, is there anyway to change it?
We have a different zabbix directory for zabbix_agentd.conf,I think that's complaining on the zabbix side and should not have affected on the pm2.
sudo PM2_HOME=/etc/data/hypernova/pm2 pm2-zabbix --monitor --debug
[ ERR ] Periodic sending of PM2 status failed: { Error: ENOENT: no such file or directory, open '/home/foo/etc/data/hypernova/pm2/pm2.pid'
There is currently an issue open (#16) that deals with home directory / PM2_HOME
handling - right now it appears to be problematic. Just to confirm - you changed where pm2
stores its pidfile / logs by launching it with a changed PM2_HOME
, too? I may need to gather some information about how pm2 paths are configured and how it handles relative-looking paths such as PM2_HOME=.pm2
.
The version on master now uses logic compatible with pm2
for determining the pidfile path. You can check if that rectifies the pidfile ENOENT issue.
The ENOENT /pid issue has been rectified. Please let me know if you need more information.
Correct, I always change the PM2_HOME directory.
Is it possible to print the command line and data to standard out for troubleshooting purpose?
[ ERR ] Periodic sending of process list error: { Error: Command failed: /usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -
at ChildProcess.exithandler (child_process.js:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:498:12)
killed: false,
code: 2,
signal: null,
cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -' }
Yes. Just launch pm2-zabbix
with an elevated log level, like this (requires 0.3.x):
LOG_LEVEL=trace pm2-zabbix --monitor
(This is now included in the README)
I am running 0.3 but I don't see anything writing on standard output. Am i missing something?
└─┬ pm2-zabbix@0.3.2
sudo PM2_HOME=/etc/data/hypernova/pm2 LOG_LEVEL=trace pm2-zabbix --discover
{
"data": [
{
"{#PROCESS_ID}": "hypernova_service-0",
"{#PROCESS_NAME}": "hypernova_service"
},
{
"{#PROCESS_ID}": "hypernova_service-1",
"{#PROCESS_NAME}": "hypernova_service"
},
{
"{#PROCESS_ID}": "hypernova_service-2",
"{#PROCESS_NAME}": "hypernova_service"
}
]
}
In discover mode, to avoid merging logs and output, logs go to stderr.
Dnia 24 lipca 2017 20:56:43 CEST, Leo Chan notifications@github.com napisał(a):
I am running 0.3 but I don't see anything writing on standard output. Am i missing something?
└─┬ pm2-zabbix@0.3.2
sudo PM2_HOME=/etc/data/hypernova/pm2 LOG_LEVEL=trace pm2-zabbix --discover { "data": [ { "{#PROCESS_ID}": "hypernova_service-0", "{#PROCESS_NAME}": "hypernova_service" }, { "{#PROCESS_ID}": "hypernova_service-1", "{#PROCESS_NAME}": "hypernova_service" }, { "{#PROCESS_ID}": "hypernova_service-2", "{#PROCESS_NAME}": "hypernova_service" } ] }
-- You are receiving this because you were assigned. Reply to this email directly or view it on GitHub: https://github.com/greatcare/pm2-zabbix/issues/15#issuecomment-317520811
-- Wysłane za pomocą K-9 Mail.
Seems like all went OK here; closing.
Version: 0.2.1
When running in discover mode, only process_id and process_name are showed up. (with a status code of 0)
/home/foo └─┬ pm2-zabbix@0.2.1 ├── minimist@1.2.0 ├── pidusage@1.1.5
I have ran --monitor --debug but it has the same result, I think the data is not picking up the data between the module and node.js and unrelated to zabbix_sender.
Any suggestion?