Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"level":50, "event":"PM2ZabbixMonitor#processListSendingError","error":{"killed":false,"code":2,"signal":null, "cmd":"/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -"} #38

Open
blueflametuna opened this issue Nov 7, 2019 · 7 comments

Comments

@blueflametuna
Copy link

I have read through the 18 open and 16 closed issues, many of them related to this error.
I have read the troubleshooting guide in the readme. I have tried changing the hostname configurations, but can't seem to make it take effect.
The entire message is:
{"name":"pm2-zabbix","hostname":"puppetagenttest","pid":17431,"level":50,"event":"PM2ZabbixMonitor#processListSendingError","error":{"killed":false,"code":2,"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":"2019-11-07T16:10:44.327Z","v":0}

On the zabbix server, the host is called puppetagenttest. I have installed the PM2 template, and I can see the items for PM2 daemon (CPU, Memory, PID, status), but nothing for the pm2.processes.

Can anyone offer suggestions on how to further troubleshoot this issue? It seems very common.

@blueflametuna
Copy link
Author

blueflametuna commented Nov 8, 2019

Turns out that the sudoers file pm2-zabbix-sudoers needs to pass and argument, as in:
# Allow the Zabbix user to run pm2-zabbix as any user, without a password.
zabbix ALL=(ALL:ALL) NOPASSWD: /usr/bin/pm2-zabbix *

# On some systems (notably RHEL and CentOS), sudo is configured to require a tty
# by default, which prevents it from working at all with the Zabbix agent.
# This lifts that default restriction.
Defaults:zabbix !requiretty

@bertalanimre
Copy link

I'm trying to make it work on CentOS 7, but it did not help me really @blueflametuna . :(

My user who I want to use pm2-zabbix with is called "web". I added him to the zabbix group and added the liney you figured out. However, I'm still getting the error message.

0 ✓ web@mywebserver ~ $ pm2-zabbix --monitor
{
   "name":"pm2-zabbix",
   "hostname":"mywebserver",
   "pid":12164,
   "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\n    at ChildProcess.exithandler (child_process.js:303:12)\n    at ChildProcess.emit (events.js:310:20)\n    at maybeClose (internal/child_process.js:1021:16)\n    at Socket.<anonymous> (internal/child_process.js:443:11)\n    at Socket.emit (events.js:310:20)\n    at Pipe.<anonymous> (net.js:672:12) {\n  killed: false,\n  code: 1,\n  signal: null,\n  cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -'\n}",
   "time":"2020-06-19T09:02:25.514Z",
   "v":0
}

Formatted it a bit, so it would be easier to read....

@blueflametuna
Copy link
Author

Not sure what you mean by "My user who I want to use pm2-zabbix with is called "web". I added him to the zabbix group ..." Do you not have a zabbix user? The line in /etc/sudoers:
zabbix ALL=(ALL:ALL) NOPASSWD: /usr/bin/pm2-zabbix *
pertains to the user zabbix, not the group. For that you might try:
%zabbix ALL=(ALL:ALL) NOPASSWD: /usr/bin/pm2-zabbix *
which would apply to the group zabbix.
Just not sure if pm2-zabbix is executable as the group zabbix. Only a guess here.

@blueflametuna
Copy link
Author

I also needed to create a nodejs host group on the zabbix server, and linked the PM2 template to that server.

@blueflametuna
Copy link
Author

blueflametuna commented Jun 19, 2020

There is one more file that you need:
/etc/zabbix/zabbix_agentd.d/pm2-zabbix.conf

UserParameter=pm2.processes,sudo -u appuser pm2-zabbix --discover

@bertalanimre
Copy link

Sorry if I wasn't clear about my setup. On my server, I have a 3rd user (who is called web) and he has pm2 installed and running the NodeJS applications. Not my main user, nor the root.

So I don't really understand why would you need to create a host group with the template while you can just simply add the template to your actual host. Are you sure that is necessary?

@blueflametuna
Copy link
Author

The template needs to be linked to the host. Whether individually, or via host group. That's just the way I did it. We have numerous nodejs servers. The zabbix agent running on the nodejs host needs to be able to connect with the zabbix server. Did you add the pm2-zabbix.conf file? Did you set the user to your pm2 user "web"? As in:
UserParameter=pm2.processes,sudo -u web pm2-zabbix --discover

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants