Code Monkey home page Code Monkey logo

Comments (8)

rkaw92 avatar rkaw92 commented on June 2, 2024

Hi, there was a bug in error handling which is now fixed in 0.3.2 - try the newest version.
The bug could only be triggered when sending fails, though - so it looks like sending the data did not succeed, after all. The new release should show the real error correctly.

As for your other question regarding the Zabbix agent drop-in config (pm2-zabbix.conf) - it needs to be installed manually and optionally customized (e.g. by adjusting the sudo user depending on your local install).

from pm2-zabbix.

sqwit avatar sqwit commented on June 2, 2024

Thanks to fix it rkaw92, now the discovery works. I've placed the pm2-zabbix.conf and i changed debian to root and place the suduers file, restart the agent. Now how do i know if the Zabbix server is getting anything?

I tried from the server zabbix_get and i've got the following:
[root@xxxxxxxxx xxx]# zabbix_get -s xxx.xxx.xxx.xxx -k pm2.status
ZBX_NOTSUPPORTED: Unsupported item key.

I also tried on the client:
[root@xxxxxx xxxx]# pm2-zabbix --monitor
{"name":"pm2-zabbix","hostname":"xxx.xxxx.internal","pid":11645,"level":50,"event":"PM2ZabbixMonitor#processListSendingError","error":{"code":"ENOENT","errno":"ENOENT","syscall":"spawn /usr/bin/zabbix_sender","path":"/usr/bin/zabbix_sender","spawnargs":["--config","/etc/zabbix/zabbix_agentd.conf","--input-file","-"],"cmd":"/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -"},"msg":"Failed to send process list with stats to server: Error: spawn /usr/bin/zabbix_sender ENOENT","time":"2017-07-20T17:37:32.343Z","v":0}

I've installed the sender via npm , but there is no /usr/bin/zabbix_sender folder there.

Thanks!

from pm2-zabbix.

rkaw92 avatar rkaw92 commented on June 2, 2024

Hi. First of all, I've uploaded [email protected] to npm just now - it was still at 0.3.1 earlier today in npm, so it might have been a bit confusing; sorry about that.

Now, ENOENT while spawning zabbix_sender surely means you do not have the binary installed. As stated in the package's prerequisites (README), it is necessary to install whatever package your distro supplies zabbix_sender with. On CentOS, I think it is just called zabbix-sender, though I have no personal experience with that distribution nor a ready instance to check it on.

As for your zabbix_get invocation on the server, let me refer to the manpage:

zabbix_get is a command line utility for getting data from Zabbix agent.

ZBX_NOTSUPPORTED seems to be a generic error returned by the agent, but one of the cases where it appears is when the key is not defined on the agent. This is correct - the agent is not the party that supplies this info.

We use the Zabbix agent for item discovery - by placing the agent config file, the server can contact the agent running on a monitored host and poll it for a process list (and this is what --discover is for). However, it is pm2-zabbix (our process) that sends PM2 status and process stats for the discovered processes. The agent will thus not have any info about PM2 status, because --discovery does not supply this data.

I would say that a good way to find out if the server is getting the data is using the management GUI (web front-end) of the Zabbix server itself.

from pm2-zabbix.

sqwit avatar sqwit commented on June 2, 2024

Hi,
I've trying to get this working on CentOS 6 and 7, i've zabbix_sender installed in both of them.

Now i'm getting the following errors:
Try from the server to the centos 7 host

[root@hostname xxx]# zabbix_get -s xx.xx.xx.x -k pm2.processes
sh: /usr/bin/sudo: Permission denied

Try from the server to the centos 6 host

[root@eac-uxr-web uxr]# zabbix_get -s 10.14.208.30 -k pm2.processes
{
"data": [
{
"{#PROCESS_ID}": "moov-client-0",
"{#PROCESS_NAME}": "moov-client"
},
{
"{#PROCESS_ID}": "pm2-logrotate-1",
"{#PROCESS_NAME}": "pm2-logrotate"
}
]
}

So looks like things are better on CentOS 6, but in both of them when i try pm2-zabbix --monitor,i get the same error below

[root@xxxxxx xxxxxx]#pm2-zabbix --monitor
{"name":"pm2-zabbix","hostname":"xxxxxxx.internal","pid":1699,"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-07-20T22:53:46.329Z","v":0}
{"name":"pm2-zabbix","hostname":"xxxxxxx.uxrlab.internal","pid":1699,"level":50,"event":"PM2ZabbixMonitor#PM2StatusSent","error":{"killed":false,"code":1,"signal":null,"cmd":"/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -"},"msg":"Failed to send PM2 status: Error: Command failed: /usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -\n","time":"2017-07-20T22:53:46.338Z","v":0}

This time on both servers, zabbix_server is there /usr/bin/zabbix_sender

I'm also not getting pm2 data on the Zabbix GUI Server.
Any clue what could be?

Thanks Again!

from pm2-zabbix.

rkaw92 avatar rkaw92 commented on June 2, 2024

On CentOS 7, it looks like your sudo is non-executable (?!). You should check if sudo works there at all.

Error code 1 in zabbix_sender means that sending failed - perhaps the connection could not be established, or if using TLS, cert auth may have failed. You should try sending some key/value manually in verbose mode using zabbix_sender and work from there. It is not a problem with pm2-zabbix at this point, but with underlying agent config file or connectivity.

from pm2-zabbix.

sqwit avatar sqwit commented on June 2, 2024

Hi, I think i got this working on CentOS 6

I did some change on zabbix_agentd.conf that was set as default and TSL was already set as unencrypted.

ServerActive=10.10.13.167 (Zabbix Server IP)
Hostname=pm2hostname (Same hostname that is in the Zabbix webpage)

Now zabbix _sender seems to be working fine:

[root@ux-ears-media01 zabbix-agent]# zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k "pm2.processes[moov-client-0,cpu]" -s ux-ears-media01 -o 90 -vv
zabbix_sender [44606]: DEBUG: answer [{"response":"success","info":"processed: 1; failed: 0; total: 1; seconds spent: 0.000050"}]
info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000050"
sent: 1; skipped: 0; total: 1

Now I'm going to setup it on startup or as a services as per your instructions.

If i got it, the server cant get any data by itself using zabbix_get, i tried some keys and thei did no work.

Once I get this fully working on CentOS 6 I will try to get this working CentOS 7, I suspect that the issue is with SELinux.

Thanks,

Bruno

from pm2-zabbix.

rkaw92 avatar rkaw92 commented on June 2, 2024

Great! From what you have posted, it seems to be working as expected. Your conclusions are correct, indeed:

  • pm2-zabbix needs to be running (it is a daemon) to send updates
  • The server can not get the data from the agent using zabbix_get, because the keys never go through the agent - they are sent directly to the server from the daemon without the agent's knowledge. This means the server can't query the agent for it to obtain the keys' values. On the other hand, you should be able to query for the process list, because it is mediated via the agent.

If you need to inspect what data exactly is being discovered / received from pm2 and sent to the server, you can pass a LOG_LEVEL environment variable to pm2-zabbix - it is a fairly new feature and documented in the README.

from pm2-zabbix.

dcdamien avatar dcdamien commented on June 2, 2024

@sqwit I'm going to close this issue. Feel free to reopen if problem still persist.

from pm2-zabbix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.