greatcare / pm2-zabbix

A Node.js PM2 monitoring tool for Zabbix.
MIT License
87 stars 60 forks source link

Improve HOME directory handling #16

Open rkaw92 opened 7 years ago

rkaw92 commented 7 years ago

There are currently two issues surrounding the use of $HOME and $PM2_HOME, and both originate from lib/PM2Tracker.js:165 :

This should be fixed by computing the proper path where we expect to find pm2.pid, and not using the user's home dir at all if PM2_HOME looks like an absolute path.

jhan-aa commented 6 years ago

{"name":"pm2-zabbix","hostname":"lw-mi-aa-s-react-1.appannie.org","pid":56575,"level":50,"event":"PM2ZabbixMonitor#PM2StatusSent","error":{"errno":-2,"code":"ENOENT","syscall":"open","path":"/var/www//etc/nodejs_home/.pm2/pm2.pid"},"msg":"Failed to send PM2 status: Error: ENOENT: no such file or directory, open '/var/www//etc/nodejs_home/.pm2/pm2.pid'","time":"2017-09-05T07:18:47.196Z","v":0} {"name":"pm2-zabbix","hostname":"lw-mi-aa-s-react-1.appannie.org","pid":56575,"level":50,"event":"PM2ZabbixMonitor#processListSendingError","error":{"killed":false,"code":1,"signal":null,"cmd":"/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -"},"msg":"Failed to send process list with stats to server: Error: Command failed: /usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -\n","time":"2017-09-05T07:18:47.208Z","v":0}

I am having the above errors, pm2 is running by www-data with a customized home dir(/etc/nodejs_home/.pm2/), Not sure why pm2-zabbix will try to find the path from "/var/www//etc/nodejs_home/.pm2/pm2.pid"}