greatcare / pm2-zabbix

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

[ ERR ] Periodic sending of PM2 status failed: { [Error: ENOENT: no such file or directory, open '/home/cibot//etc/pm2/pm2.pid'] #3

Closed claflico closed 7 years ago

claflico commented 8 years ago

Running these commands as my cibot user. I'm running pm2 as a service as the cibot user and have set the pm2 pid file to be in /etc/pm2. Below is what happens when I try to use pm2-zabbix:

pm2-zabbix --discover { "data": [ { "{#PROCESS_ID}": "pm2-http-interface-0", "{#PROCESS_NAME}": "pm2-http-interface" }, { "{#PROCESS_ID}": "chm-dev-api-1", "{#PROCESS_NAME}": "chm-dev-api" } ] }

pm2-zabbix --monitor --debug

claflico commented 8 years ago

CentOS 7, node v4.4.5

rkaw92 commented 8 years ago

Not sure if this kind of setup is supported right now - as you can see, the path is constructed from the user's home directory. How did you get it to read a path containing "/etc/pm2/" in the first place - did you override PM2_HOME?

One idea I have is making a symlink from somewhere in your home directory to /etc/pm2. How does that sound?

The second error is something else entirely - looks like the server is not accepting your parameters' values (Zabbix-side misconfiguration?).

claflico commented 8 years ago

Yes, I override PM2_HOME via my /etc/environment file. I made some changes to the pm2 install to make it more of a central service. I got tired of it doing goofy stuff every time I rebooted the node, restarted the service, or had a developer login and make changes to their config.

I put the processes I want to run in a processes.json file and put that file and the PIDs in /etc/pm2. Logs go in /var/log/pm2. I changed the pm2.service file to start the pm2 process pointing to that processes.json file and run as my cibot user.

As for the other error, I tried following the steps I saw in the issue from the other user but it all seemed to check out. The hostname in my agent file and in my server match. I know some PM2 data is getting in there because the PID it shows in Zabbix matches what the service shows. I'll keep playing.

rkaw92 commented 8 years ago

The relevant data items may not exist on the server. Exit code 2 means that at least some items could not be sent (not a communication error - Zabbix really is rejecting some items) - perhaps the per-application entries have not been created? Make sure you have the app template installed and that discovery via the agent has completed.

I might have to take another look at PM2_HOME handling in pm2 itself - I had assumed it was only supported as a path name relative to $HOME before, but it does not seem to be the case.

rkaw92 commented 7 years ago

Is this still relevant? I'm doing a run through pm2-zabbix issues before the next release.

claflico commented 7 years ago

Not sure, haven't had time to try it again and we are starting to move our apps to docker so not sure how much longer we'll be using PM2.

rkaw92 commented 7 years ago

I am now closing this issue because:

Please re-open if still experiencing the same failure while sending to Zabbix. Otherwise, use the other issue to track path handling improvement.

jhan-aa commented 7 years ago

Actually i am having the same issue, still strugling on it