greatcare / pm2-zabbix Goto Github PK
View Code? Open in Web Editor NEWA Node.js PM2 monitoring tool for Zabbix.
License: MIT License
A Node.js PM2 monitoring tool for Zabbix.
License: MIT License
I'm having a problem sending pm2 process information to zabbix 3.0.1
pm2-zabbix --monitor --debug
* Client running (monitor mode: on)
[ OK ] Periodic sending of PM2 status succeeded
[ ERR ] Periodic sending of process list error: { [Error: Command failed: ] killed: false, code: 2, signal: null }
PM2 Status is OK in zabbix but PM2 Processes discovery rule does not trigger stating "Value should be a JSON object"
Running on CentOS 7.2.1511 (Core)
Example: This just works out of box, like the others.
pm2.processes[{#PROCESS_ID},status]
Wondering how to get "uptime". Things i have tried for this key just fail to do nothing.
What I have tried:
pm2.processes[{#PROCESS_ID},uptime]
pm2 list shows all of them. not sure how to get uptime via discovery method with out home grown
key being made.
┌─────────────┬────┬──────┬──────┬────────┬─────────┬────────┬──────────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
├─────────────┼────┼──────┼──────┼────────┼─────────┼────────┼──────────────┼──────────┤
│mystery-app │ 4 │ fork │ 8354 │ online │ 0 │ 8m │ 124.223 MB │ disabled │
│ mystery-daemon │ 5 │ fork │ 8355 │ online │ 0 │ 8m │ 45.234 MB │ disabled │
Raw Audit Messages
type=AVC msg=audit(1573184726.101:864): avc: denied { connectto } for pid=17463 comm="sudo" path="/run/dbus/system_bus_socket" scontext=system_u:system_r:zabbix_agent_t:s0 tcontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tclass=unix_stream_socket permissive=0
Also related:
SELinux is preventing /usr/bin/node from write access on the sock_file rpc.sock.
Raw Audit Messages
type=AVC msg=audit(1573184726.86:862): avc: denied { write } for pid=17465 comm="node" name="rpc.sock" dev="dm-0" ino=50787429 scontext=system_u:system_r:zabbix_agent_t:s0 tcontext=unconfined_u:object_r:var_log_t:s0 tclass=sock_file permissive=0
Can this be resolved with a simple context change, or do I need to install new policy modules?
~# node -v
v14.15.4
I have Zabbix 5.0.4. Can't use pm2-zabbix due to the next problem:
~# pm2-zabbix --discover
(node:6980) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6980) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:6980) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
...
[KM] Connecting
internal/fs/utils.js:779
throw new ERR_INVALID_ARG_TYPE(
^
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (6999)
at Object.writeFileSync (fs.js:1460:5)
at daemonize (/usr/local/lib/node_modules/pm2-zabbix/node_modules/pm2/lib/Interactor/InteractorDaemonizer.js:237:6)
at /usr/local/lib/node_modules/pm2-zabbix/node_modules/pm2/lib/Interactor/InteractorDaemonizer.js:186:7
at ReqSocket.<anonymous> (/usr/local/lib/node_modules/pm2-zabbix/node_modules/pm2/lib/Interactor/InteractorDaemonizer.js:41:12)
at Object.onceWrapper (events.js:421:28)
at ReqSocket.emit (events.js:315:20)
at Timeout._onTimeout (/usr/local/lib/node_modules/pm2-zabbix/node_modules/pm2-axon/lib/sockets/sock.js:278:12)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7) {
code: 'ERR_INVALID_ARG_TYPE'
}
Hi
i get this error...
Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-118-generic x86_64)
Zabbix Server 5.0.4
zabbix_sender (Zabbix) 5.0.4
"name":"pm2-zabbix",
"hostname":"pro-rool",
"pid":45131,
"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\n at ChildProcess.exithandler (child_process.js:308:12)\n at ChildProcess.emit (events.js:314:20)\n at maybeClose (internal/child_process.js:1047:16)\n at Socket. (internal/child_process.js:438:11)\n at Socket.emit (events.js:314:20)\n at Pipe. (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-10-02T00:26:24.228Z",
"v":0
Here is an example. I'm simulating the parsing of the input from pm2-zabbix --monitor, which produces a key-value stream which is parsed by zabbix-sender and sent. I'm fetching just one row from this stream, and sending to zabbix:
echo "xxxxx-be-preprod01 pm2.processes[xxxxx Frontend-0,cpu] 90" | zabbix_sender -vv --config /etc/zabbix/zabbix_agentd.conf -s hostname
--input-file -
zabbix_sender [25699]: DEBUG: answer [{"response":"success","info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000028"}]
info from server: "processed: 0; failed: 1; total: 1; seconds spent: 0.000028"
So, if there are spaces in pm2 process, the server fails to process the monitor part. The "discover" part is working, though, because if we enclose the key with double quotes, it goes through:
echo "xxxxxx-be-preprod01 "pm2.processes[xxxxx Frontend-0,cpu]" 90" | zabbix_sender -vv --config /etc/zabbix/zabbix_agentd.conf -s hostname
--input-file -
zabbix_sender [25131]: DEBUG: answer [{"response":"success","info":"processed: 1; failed: 0; total: 1; seconds spent: 0.000083"}]
info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000083"
hello, thanks for your document, I did with your document , but now the zabbix-server has no date , I cannot find where I'am wrong , every step is the same you said , and. my zabbix-servser is 3.2 can I use your template and could you tell me how can I test form zabbix-client to zabbix-server thanks
As you have a daemon running, why not feed in the discovery items via the trapper as well as the normal stats? I do this on a number of things and it works fine. This means you can remove the agent configuration step of the setup. Not a big deal, but maybe good to have the option.
Hi team,
I got below error while running
pm2-zabbix --monitor command , can anyone please help to resolve this issue.
please find error logs:
{"name":"pm2-zabbix","hostname":"Dev-210-APP","pid":70413,"level":50,"event":"PM2ZabbixMonitor#PM2StatusSent","error":{"errno":-2,"code":"ENOENT","syscall":"open","path":"/home/devops//usr/local/share/.pm2/pm2.pid"},"msg":"Failed to send PM2 status: Error: ENOENT: no such file or directory, open '/home/devops//usr/local/share/.pm2/pm2.pid'","time":"2019-03-20T14:10:06.108Z","v":0}
{"name":"pm2-zabbix","hostname":"Dev-210-APP","pid":70413,"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-03-20T14:10:06.431Z","v":0}
None of the process resource usage info seems to be coming up to Zabbix.
There's a commit from Jan 26th that updates to the "new" PM2 api, but it hasn't been released as the latest version (0.1.2) is from last April (2016).
@rkaw92 could you cut a new release, please?
Hi i am facing error during running pm2-zabbix --monitor ,
{"name":"pm2-zabbix","hostname":"ip-172-31-43-89","pid":5808,"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":"2018-11-05T15:12:36.599Z","v":0}
i tried sending some key
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k test_key -o 0
sent: 1; skipped: 0; total: 1
i stop pm2 process but didnt receive any tirgger .
Hello,
I am using a Zabbix server and I am using your pm2-Zabbix. I want to check the status of applications on pm2. When any of the apps stops, I want an alarm. How can i do it, can you help me?
For example, the "logHandler" application has stopped, but it is too late for me to know. I have big problems in this regard. I'm not open to your suggestions.
│ App name │ id │ mode │ pid │ status │ ...
...
│ api │ 123 │ cluster │ 2422 │ online │ ...
│ image-proxy │ 71 │ cluster │ 25504 │ online │ ...
│ indexerIntegrityHandler │ 981 │ cluster│ 89351 │ online │ ...
│ logHandler │ 961 │ cluster │ 01 │ stopped │ ...
│ web │ 208 │ cluster │ 25192 │ online │ ...
...
hello I followed the tutorial, I've tried replacing the hostname on the monitor.js
The connection works fine this is a working zabbix agent node.
pm2-zabbix --discover works well and shows all the pm2 processes but pm2-zabbix --monitor gives the following errors
{"name":"pm2-zabbix","hostname":"CentOS-77-64-minimal","pid":25279,"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\n at ChildProcess.exithandler (child_process.js:303:12)\n at ChildProcess.emit (events.js:311:20)\n at maybeClose (internal/child_process.js:1021:16)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {\n killed: false,\n code: 2,\n signal: null,\n cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -'\n}","time":"2020-12-15T11:42:40.886Z","v":0}
{"name":"pm2-zabbix","hostname":"CentOS-77-64-minimal","pid":25279,"level":50,"event":"PM2ZabbixMonitor#PM2StatusSent","error":{"killed":false,"code":2,"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\n at ChildProcess.exithandler (child_process.js:303:12)\n at ChildProcess.emit (events.js:311:20)\n at maybeClose (internal/child_process.js:1021:16)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {\n killed: false,\n code: 2,\n signal: null,\n cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -'\n}","time":"2020-12-15T11:42:40.891Z","v":0}
{"name":"pm2-zabbix","hostname":"CentOS-77-64-minimal","pid":25279,"level":50,"event":"PM2ZabbixMonitor#PM2StatusSent","error":{"killed":false,"code":2,"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\n at ChildProcess.exithandler (child_process.js:303:12)\n at ChildProcess.emit (events.js:311:20)\n at maybeClose (internal/child_process.js:1021:16)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {\n killed: false,\n code: 2,\n signal: null,\n cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -'\n}","time":"2020-12-15T11:42:55.900Z","v":0}
{"name":"pm2-zabbix","hostname":"CentOS-77-64-minimal","pid":25279,"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\n at ChildProcess.exithandler (child_process.js:303:12)\n at ChildProcess.emit (events.js:311:20)\n at maybeClose (internal/child_process.js:1021:16)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {\n killed: false,\n code: 2,\n signal: null,\n cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -'\n}","time":"2020-12-15T11:42:55.912Z","v":0}
I can't seem to understand what could be the issues, I've tried with loglevel=trace but still doesn't show any clue.
What could be the issue?
When I want to install when running npm install -g pm2-zabbix gives the following log
npm WARN addRemoteGit greatcare/node-zabbix-sender#v0.3.0 resetting remote /root/.npm/_git-remotes/git-github-com-greatcare-node-zabbix-sender-git-328e4dce because of error: { [Error: not found: git] code: 'ENOGIT' }
npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror [email protected]:greatcare/node-zabbix-sender.git /root/.npm/_git-remotes/git-github-com-greatcare-node-zabbix-sender-git-328e4dce: undefined
npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror [email protected]:greatcare/node-zabbix-sender.git /root/.npm/_git-remotes/git-github-com-greatcare-node-zabbix-sender-git-328e4dce: undefined
npm ERR! Linux 2.6.32-696.18.7.el6.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "pm2-zabbix"
npm ERR! node v4.8.7
npm ERR! npm v2.15.11
npm ERR! code ENOGIT
npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! Please include the following file with any support request:
npm ERR! /etc/zabbix/zabbix_agentd.d/npm-debug.log
necesito ayuda
We need some legitimate logging support. The current solution, being the --debug
CLI option, has several drawbacks; the final implementation should at least:
zabbix_sender
invocation parameters and results/exit codes if requestedhello im having a issue with pm2-zabbix. im am new to zabbix
{"name":"pm2-zabbix","hostname":"pi","pid":26920,"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-05-10T16:42:58.057Z","v":0}
{"name":"pm2-zabbix","hostname":"pi","pid":26920,"level":50,"event":"PM2ZabbixMonitor#PM2StatusSent","error":{"killed":false,"code":2,"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":"2019-05-10T16:42:58.112Z","v":0}
I installed the pm2-zabbix, but when I try to execute the command pm2-zabbix --discover returns this internal/modules/cjs/loader.js:550
throw err;
^
Error: Cannot find module 'zabbix-sender'. I'm using the version 4.4, what can i do fix this problem.
when i use this command zabbix_sender -V
return this.
Zabbix Sender v2.4.7 (revision 56694) (12 November 2015).
I need to do some change in your code, change some variables??
906 timing command:install Completed in 1262ms
907 verbose stack Error: An unknown git error occurred
907 verbose stack at makeError (/usr/lib/node_modules/npm/node_modules/@npmcli/git/lib/make-error.js:28:13)
907 verbose stack at /usr/lib/node_modules/npm/node_modules/@npmcli/git/lib/spawn.js:37:26
907 verbose stack at processTicksAndRejections (node:internal/process/task_queues:96:5)
908 verbose cwd /
909 verbose Linux 6.5.0-1019-oracle
910 verbose node v16.20.2
911 verbose npm v8.19.4
912 error code ENOENT
913 error syscall spawn git
914 error path git
915 error errno -2
916 error enoent An unknown git error occurred
917 error enoent This is related to npm not being able to find a file.
917 error enoent
918 verbose exit -2
Hello, could you help me! I´m trying to make pm2-zabbix works but i can´t. I got the following error:
{"name":"pm2-zabbix","hostname":"ip-172-31-15-19","pid":3861865,"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 -\nzabbix_sender [3861937]: ./zabbix_agent2.d/plugins.d: [2] No such file or directory\n\n at ChildProcess.exithandler (node:child_process:397:12)\n at ChildProcess.emit (node:events:390:28)\n at maybeClose (node:internal/child_process:1064:16)\n at Socket. (node:internal/child_process:450:11)\n at Socket.emit (node:events:390:28)\n at Pipe. (node:net:687: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":"2022-10-21T16:20:02.162Z","v":0}
this problem runs if i start the pm2-zabbix service or if i run pm2-zabbix --monitor out of /etc/zabbix directory.
The test is being doing in a ubunt 20.04 with zabbix-agent2
1. pm2-zabbix --discover
{
"data": [
{
"{#PROCESS_ID}": "[email protected]",
"{#PROCESS_NAME}": "[email protected]"
}
]
2. /etc/zabbix/zabbix_agentd.conf
############ GENERAL PARAMETERS #################
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=1
DebugLevel=4
EnableRemoteCommands=1
LogRemoteCommands=1
Server=zabbix.internal.com
ServerActive=zabbix.internal.com
StartAgents=5
Hostname=api-test
#Include=/etc/zabbix/zabbix_agentd.d/
#UserParameter
UserParameter=pm2.processes,root /usr/local/nodejs/bin/pm2-zabbix --discover
3. /etc/sudoers
#includedir /etc/sudoers.d
zabbix ALL=(ALL) NOPASSWD: ALL
Defaults:zabbix !requiretty
4. Server
Name Triggers Key Interval History Trends Type Applications Status
Template App PM2: PM2 Daemon Status Triggers 1 pm2.status 90d Zabbix trapper PM2 Daemon Enabled
Template App PM2: PM2 Daemon PID Triggers 1 pm2.pid 90d 365d Zabbix trapper PM2 Daemon Enabled
Template App PM2: PM2 Daemon Memory Usage pm2.memory 90d 365d Zabbix trapper PM2 Daemon Enabled
Template App PM2: PM2 Daemon CPU Usage pm2.cpu 90d 365d Zabbix trapper PM2 Daemon Enabled
[ ERR ] Periodic sending of PM2 status failed: { [Error: Command failed: /usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -
]
killed: false,
code: 2,
signal: null,
cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -' }
from host with zabbix-agent:
- ls /usr/bin/zabbix_sender
/usr/bin/zabbix_sender
- Has the discovery process completed successfully? Are your processes listed in the Zabbix Web UI for the host that you're sending from?
Applications from Template APP PM2
Application Items
PM2 Daemon Items 0
PM2 Processes Items 4
Itens from Application PM2 Processes:
PM2 Daemon Status Triggers 1 pm2.status 90d Zabbix trapper PM2 Processes Enabled
PM2 Daemon PID Triggers 1 pm2.pid 90d 365d Zabbix trapper PM2 Processes Enabled
PM2 Daemon Memory Usage pm2.memory 90d 365d Zabbix trapper PM2 Processes Enabled
PM2 Daemon CPU Usage pm2.cpu 90d 365d Zabbix trapper PM2 Processes Enabled
- Does the hostname configured on the server match the hostname that the client is presenting itself as? In particular, compare the output of hostname with the Zabbix Server's notion of your monitored machine's hostname (if using the default HostnameItem setting).
yep, the hostnames match
- If the above does not explain the failure: can you send any data item manually, using zabbix_sender from the CLI?
Test01 --> OK
zabbix_sender -z zabbix.internal.com -s "api-test" -k pm2.cpu -o 43
info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000245"
sent: 1; skipped: 0; total: 1
Test02 --> FAIL
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k "pm2.processes[www-0,cpu]" -s "api-test" -o 90 -vv
zabbix_sender [11909]: DEBUG: answer [{"response":"success","info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000113"}]
info from server: "processed: 0; failed: 1; total: 1; seconds spent: 0.000113"
sent: 1; skipped: 0; total: 1
from zabbix-server
./usr/local/bin/zabbix_get -s 172.xx.xx.xxx -k pm2.processes
{
"data": [
{
"{#PROCESS_ID}": "[email protected]",
"{#PROCESS_NAME}": "[email protected]"
}
]
}
root@lw-mi-aa-s-react-1:~/pm2-zabbix/install/zabbix-agent# sudo -u www-data PM2_HOME=/etc/nodejs_home/.pm2 pm2-zabbix --monitor {"name":"pm2-zabbix","hostname":"lw-mi-aa-s-react-1.appannie.org","pid":7084,"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-07T09:12:57.505Z","v":0} {"name":"pm2-zabbix","hostname":"lw-mi-aa-s-react-1.appannie.org","pid":7084,"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-07T09:12:57.523Z","v":0}
root@lw-mi-aa-s-react-1:~/pm2-zabbix/install/zabbix-agent# sudo -u www-data PM2_HOME=/etc/nodejs_home/.pm2 pm2-zabbix --discover { "data": [ { "{#PROCESS_ID}": "AA React-0", "{#PROCESS_NAME}": "AA React" }, { "{#PROCESS_ID}": "AA React-1", "{#PROCESS_NAME}": "AA React" }, { "{#PROCESS_ID}": "AA React-2", "{#PROCESS_NAME}": "AA React" }
I am running the pm2 and nodejs with www-data, and a customize home dir. I can get the data by --discover; But from zabbix it did not collect anything. Can you help check where i loss configuration from the above output
error when import template
Cannot read XML: (41) Specification mandate value for attribute data-pjax-transient [Line: 43 | Column: 89].
Hi, I wanted to get up-to-date data about a running process in PM2 using zabbix.
When trying to run pm2-zabbix –monitor:
"name":"pm2-zabbix","hostname":"node","pid":2440,"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\n at ChildProcess.exithandler (child_process.js: 308:12)\n at ChildProcess.emit (events.js:314:20)\n at maybeClose (internal/child_process.js:1022:16)\n at Socket.<anonymous> (internal/child_process.js:444 :11)\n at Socket.emit (events.js:314:20)\n at Pipe.<anonymous> (net.js:676:12) {\n killed: false,\n code: 2,\n signal: null,\n cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -'\n}","time":"2022-08-19T09:28 :27.553Z","v":0}
When trying to run LOG_LEVEL=trace pm2-zabbix –monitor:
{"name":"pm2-zabbix","hostname":"node","pid":2492,"level":30,"event":"PM2ZabbixMonitor#starting","monitor":true,"msg":"Starting PM2ZabbixMonitor (monitoring enabled: true)","time":"2022-08-19T09:45:49.918Z","v":0}
{"name":"pm2-zabbix","hostname":"node","pid":2492,"level":20,"event":"PM2ZabbixMonitor#processMapGenerated","processMap":{"hello-0":{"name":"hello","status":"online","resources":{"memory":53964800,"cpu":0},"restarts":0}},"msg":"Process map generated","time":"2022-08-19T09:45:49.955Z","v":0}
{"name":"pm2-zabbix","hostname":"node","pid":2492,"level":30,"event":"PM2ZabbixMonitor#started","msg":"PM2ZabbixMonitor started","time":"2022-08-19T09:45:49.956Z","v":0}
{"name":"pm2-zabbix","hostname":"node","pid":2492,"level":10,"event":"PM2ZabbixMonitor#gotProcessMap","processMap":{"hello-0":{"name":"hello","status":"online","resources":{"memory":53964800,"cpu":0},"restarts":0}},"msg":"","time":"2022-08-19T09:46:04.967Z","v":0}
{"name":"pm2-zabbix","hostname":"node","pid":2492,"level":20,"event":"PM2ZabbixMonitor#sendProcessList","processList":{"pm2.processes[hello-0,status]":"online","pm2.processes[hello-0,cpu]":0,"pm2.processes[hello-0,memory]":53964800,"pm2.processes[hello-0,restarts]":0},"msg":"Sending process list with stats","time":"2022-08-19T09:46:04.967Z","v":0}
{"name":"pm2-zabbix","hostname":"node","pid":2492,"level":10,"event":"ZabbixSender#send","bin":"/usr/bin/zabbix_sender","args":["--config","/etc/zabbix/zabbix_agentd.conf","--input-file","-"],"stdIn":"node pm2.processes[hello-0,status] online\nnode pm2.processes[hello-0,cpu] 0\nnode pm2.processes[hello-0,memory] 53964800\nnode pm2.processes[hello-0,restarts] 0\n","debug":false,"msg":"Executing: /usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -","time":"2022-08-19T09:46:04.969Z","v":0}
{"name":"pm2-zabbix","hostname":"node","pid":2492,"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\n at ChildProcess.exithandler (child_process.js:308:12)\n at ChildProcess.emit (events.js:314:20)\n at maybeClose (internal/child_process.js:1022:16)\n at Socket.<anonymous> (internal/child_process.js:444:11)\n at Socket.emit (events.js:314:20)\n at Pipe.<anonymous> (net.js:676:12) {\n killed: false,\n code: 2,\n signal: null,\n cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -'\n}","time":"2022-08-19T09:46:04.994Z","v":0}
{"name":"pm2-zabbix","hostname":"node","pid":2492,"level":10,"event":"PM2ZabbixMonitor#gotPM2State","processState":{"name":"PM2","status":"online","resources":{"cpu":0.2371246925837011,"memory":61444096},"restarts":0,"pid":1131},"msg":"","time":"2022-08-19T09:46:05.003Z","v":0}
{"name":"pm2-zabbix","hostname":"node","pid":2492,"level":20,"event":"PM2ZabbixMonitor#sendPM2Status","status":{"pm2.status":"online","pm2.cpu":0.2371246925837011,"pm2.memory":61444096,"pm2.pid":1131},"msg":"Sending PM2 status","time":"2022-08-19T09:46:05.004Z","v":0}
{"name":"pm2-zabbix","hostname":"node","pid":2492,"level":10,"event":"ZabbixSender#send","bin":"/usr/bin/zabbix_sender","args":["--config","/etc/zabbix/zabbix_agentd.conf","--input-file","-"],"stdIn":"node pm2.status online\nnode pm2.cpu 0\nnode pm2.memory 61444096\nnode pm2.pid 1131\n","debug":false,"msg":"Executing: /usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -","time":"2022-08-19T09:46:05.005Z","v":0}
{"name":"pm2-zabbix","hostname":"node","pid":2492,"level":20,"event":"PM2ZabbixMonitor#PM2StatusSent","msg":"PM2 status sent","time":"2022-08-19T09:46:05.020Z","v":0}
i studied this https://github.com/greatcare/pm2-zabbix/blob/master/Troubleshooting.md
pm2-daemon was successfully discovered in zabbix, while there is no information about the child process pm2 --discovery successfully detects running processes.
The hostname on the node is the same as the hostname in zabbix-agent.conf and is the same as the node on the zabbix server
I can successfully send data using zabbix-sender
Resources used: Ubuntu server 22, NPM 8.5.1, PM2 5.2.0, PM2-zabbix 0.3.2.
I will appreciate any help, thanks
When using zabbix-agent 2 or another zabbix-agent installation path, you cannot reassign the path to the config file.
I follow the #2 to test,but the problem still existed。
Different from the above, my zabbix web UI can display the data of pm2 item value,although i got errors as i ran "pm2-zabbix monitor debug"
[www@web-app1 ~]$ pm2-zabbix --monitor --debug
{"name":"pm2-zabbix","hostname":"web-app1","pid":11222,"level":50,"event":"PM2ZabbixMonitor#PM2StatusSent","error":{"killed":false,"code":2,"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":"2018-10-16T07:23:10.230Z","v":0}
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.
Folks, I am also facing issue while performing pm2-zabbix --monitor . Getting following result. Tried many thread to resolve this but couldnt make it work. can anyone please help !!
{"name":"pm2-zabbix","hostname":"ip-172-31-31-237","pid":3866,"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-02-06T10:12:53.676Z","v":0}
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b v0.3.0 git://github.com/greatcare/node-zabbix-sender.git /home/staff/user/.npm/_cacache/tmp/git-clone-9cd49948
npm ERR! /home/staff/user/.npm/_cacache/tmp/git-clone-9cd49948/.git: Permission denied
ENV:
6.1.0
v10.2.1
Hi there!
I've tried using this Package, but my zabbix-agent doesn't seem to like the configuration file for whatever reason.
I can't seem to figure out why and the Error it is giving me isn't helping at all.
zabbix_agentd[575]: active check "pm2.processes" is not supported: Unsupported item key.
Meanwhile pm2-zabbix is saying that it Failed to send any Information to my Zabbix Server, but I presume that is because of the zabbix-agent not understanding the config since other than the PM2 stuff, it's working fine.
My Config File contains this:
UserParameter=pm2.processes,sudo -u root pm2-zabbix --discover
Hello
I've try install your package and get this error:
32 verbose Linux 3.10.0-514.26.2.el7.x86_64
33 verbose argv "/usr/bin/node" "/bin/npm" "install" "-g" "pm2-zabbix"
34 verbose node v8.4.0
35 verbose npm v5.3.0
36 error Error while executing:
36 error /bin/git ls-remote -h -t ssh://[email protected]/greatcare/node-zabbix-sender.git
36 error
36 error fatal: failed to stat '.': Permission denied
36 error
36 error exited with error code: 128
37 verbose exit [ 1, true ]
Like you can see, this command: /bin/git ls-remote -h -t ssh://[email protected]/greatcare/node-zabbix-sender.git
- cannot execute if you don't have account (with pub key) on github
There are currently two issues surrounding the use of $HOME
and $PM2_HOME
, and both originate from lib/PM2Tracker.js:165 :
process.env.HOME
is used, instead of os.homedir()
.PM2_HOME
(defaulted to .pm2
) to produce the path to PM2 pidfile, even though the user may wish to override PM2_HOME
completely to use an external path, for example /etc/pm2
(as demonstrated in #3 ).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.
So, I have used pm2-zabbix for about 1 year, works great. Thanks for that.
It came to my attention from a developer in that the following visuals are troublesome.
If, for instance a particular application, "pm2-api_app" climbs in memory usage
pm2-zabbix does do its job, sends an alert and from "Monitoring->Latest-Data->Host-Pm2-app
it shows proper spikes/triggers in graph.
If I were to select same host and go right to graphs, bypassing "Latest Data"
The graph is not to the same scale and does not show the correct memory usage, meaning much lower
than that of "Latest Data"
I understand that graph prototype may not have the trigger lines in it, that is fine.
I just would like to know why the discrepancy happens from the graph prototype vs latest data graph
for the same application's memory check.
Thanks
Hi,
I installed pm2-zabbix on a fresh Ubuntu 16.04 LTS LXC container (privileged), after install I tried pm2-zabbix --monitor
using user root and I receive
{"name":"pm2-zabbix","hostname":"app01","pid":26409,"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":"2018-04-11T18:20:52.257Z","v":0}
The same error appears if I will perform the command with user zabbix.
Next error I receive is if I will start pm2-zabbix using systemd systemctl status pm2-zabbix
● pm2-zabbix.service - PM2 monitor for Zabbix
Loaded: loaded (/etc/systemd/system/pm2-zabbix.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-04-11 18:29:40 UTC; 4s ago
Process: 26966 ExecStart=/usr/local/bin/pm2-zabbix --monitor (code=exited, status=217/USER)
Main PID: 26966 (code=exited, status=217/USER)
Apr 11 18:29:40 app01 systemd[1]: Started PM2 monitor for Zabbix.
Apr 11 18:29:40 app01 systemd[26966]: pm2-zabbix.service: Failed at step USER spawning /usr/local/bin/pm2-zabbix: No such process
Apr 11 18:29:40 app01 systemd[1]: pm2-zabbix.service: Main process exited, code=exited, status=217/USER
Apr 11 18:29:40 app01 systemd[1]: pm2-zabbix.service: Unit entered failed state.
Apr 11 18:29:40 app01 systemd[1]: pm2-zabbix.service: Failed with result 'exit-code'.
PM2 is running under user root and sudoers file is installed.
Sending with zabbix_sender
works fine!
Anything else I can check?
Fantastic daemon! 👏 I got it working with our web front ends running Ubuntu 16.04 using a Zabbix 2.4.8 server. Happy to post more details, if needed.
Dear greatcare
i got problem like someone in issue section found and i try to reading trubleshooting guide but cannot solve
the problem is i got code 2 from zabbix_sender but it work when i try to use manually cli i check in zabbix_agentd.conf Hostname and Hostnameitem and /etc/hosts file are same with config with Zabbixserver (ADVWSNodeAPI)
pls help me to solve this
Hello,
Not able to send pm2 processes to the Zabbix server using pm2-zabbix. Getting below error.
It was working fine with Ubuntu 16.04. After upgrading to Ubuntu 18.04 it stopped working.
How to fix it? Any idea?
Zabbix server: 4.0.9
Zabbix agent: 4.0.22
Ubuntu: 18.04
OPENSSL: 1.1.1g
GNUTLS: 3.5.18
Zabbix Agent Conf:
TLSConnect=psk
TLSAccept=psk
TLSPSKIdentity=PSK 001
TLSPSKFile=/etc/zabbix/zabbix_agentd.psk
zabbix-agent log
SSL_shutdown() with zabbix.server set result code to 1: file ../ssl/ssl_lib.c line 2086: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init 20356:20200704:182146.522 active check configuration update from [mon.leapven.com:15001] started to fail (TLS read set result code to 1: file ../ssl/record/rec_layer_s3.c line 1544: error:1409445C:SSL routines:ssl3_read_bytes:tlsv13 alert certificate required: SSL alert number 116: TLS read fatal alert "unknown") 20356:20200704:182146.522 End of refresh_active_checks():FAIL
pm2-zabbix Error:
{"name":"pm2-zabbix","hostname":"test","pid":25087,"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:315: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:315:20)\n at Pipe.<anonymous> (net.js:674: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-07-07T14:27:45.263Z","v":0}
Hi All...
I've tried to get pm2-zabbix to work on CentOS 6 and 7 with Zabbix 3.2 agent, but in both cases i had the bellow error after installation using npm. I also verified if the pm2-zabbix.conf was placed in /etc/zabbix/zabbix_agentd.d/, but the file was not there. Is it done automatically?
/usr/lib/node_modules/pm2-zabbix/lib/PM2ZabbixMonitor.js:61
self._logger.error({ event: 'PM2ZabbixMonitor#processUpdateSendingError', error: error, processID: changeEvent.processID, newState: changeEvent.newState }, 'Real-time status update sending failed for process %s: %s', changeEvent.processID, );
^
SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/lib/node_modules/pm2-zabbix/monitor.js:5:24)
UserParameter=pm2.processes,sudo -u root /usr/local/node/bin/pm2-zabbix --discover
{
"data": [
{
"{#PROCESS_ID}": "www-1",
"{#PROCESS_NAME}": "www"
},
{
"{#PROCESS_ID}": "pm2-http-interface-2",
"{#PROCESS_NAME}": "pm2-http-interface"
}
]
}[root@upelk2 ~]#
zabbix server is no pm2-zabbix graph
I think this needs --monitor
-- yes? https://github.com/greatcare/pm2-zabbix/blob/master/install/init/sysv/pm2-zabbix#L47
Hello!
I have the following problem, i installed and configured successfully pm2-zabbix, when i trigger --discover i can see all my node apps in the data: [ ] format. But the items are not created in zabbix, all i can see are those that are not part of the Discovery rule in Zabbix. So my suggestion is that despite i can run the discovery command successful it fails to send the data to Zabbix server. I tried to switch between trapper and agent but still no joy. Any suggestions?
Feedback a problem
Installation failed on centos 6.8
when start pm2-zabbix service:
/etc/init.d/pm2-zabbix: line 46: log_daemon_msg: command not found
/etc/init.d/pm2-zabbix: line 47: start-stop-daemon: command not found
/etc/init.d/pm2-zabbix: line 49: log_end_msg: command not found
but Successful installation on Ubuntu16.04
thanks a lot !
Hi, it is possible to monitor two or more PM2 instances under different users?
While discovery it is not a problem to deal with, how about pm2.[cpu,memory,status,processes] commands?
Hi
the code inside the PM2Tracker.js get the wrong pm2.pid path.
Using var PM2_HOME = process.env.HOME + '/' + (process.env.PM2_HOME || '.pm2');,
the code prepend the user home directory to the PM2_HOME environment variable and according to the code on node_modules/pm2/paths.js
I think can be useful modify the code like this
if (process.env.PM2_HOME) PM2_HOME = process.env.PM2_HOME; else if (process.env.HOME && !process.env.HOMEPATH) PM2_HOME = p.resolve(process.env.HOME, '.pm2'); else if (process.env.HOME || process.env.HOMEPATH) PM2_HOME = p.resolve(process.env.HOMEDRIVE, process.env.HOME || process.env.HOMEPATH, '.pm2'); else { console.error('[PM2][Initialization] Environment variable HOME (Linux) or HOMEPATH (Windows) are not set!'); console.error('[PM2][Initialization] Defaulting to /etc/.pm2'); PM2_ROOT_PATH = p.resolve('/etc', '.pm2'); }
Hi
Im having the same problem, if tried everthing i can find on google but nuthing helps..
I made a replica of two of my servers (nginx + varnish and nodejs), on the original server everthing is working fine with zabbix,
however on my replicas i'm havig problems with pm2-zabbix and zabbix-varnish but no problem with system info or nginx info.
This is the error i get wen i run (on the node server) "sudo pm2-zabbix --monitor --debug":
{"name":"pm2-zabbix","hostname":"nodejs61replica","pid":98546,"level":50,"event":"PM2ZabbixMonitor#PM2StatusSent","error":{"kilt-file -"},"msg":"Failed to send PM2 status: Error: Command failed: /usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.c
{"name":"pm2-zabbix","hostname":"nodejs61replica","pid":98546,"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":"2020-05-03T10:10:03.944Z","v":0}
on my varnish server i run "sudo /usr/local/bin/zabbix-varnish-cache.py -i '' send -c /etc/zabbix/zabbix_agentd.conf" and it seems evrthing is OK but zabbix server dos not recive the info:
serHelp please!
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 └─┬ [email protected] ├── [email protected] ├── [email protected]
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?
$ sudo PM2_HOME=/etc/data/hypernova/pm2 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"
}
]
$ sudo PM2_HOME=/etc/data/hypernova/pm2 pm2 status
┌───────────────────┬────┬─────────┬───────┬────────┬─────────┬────────┬─────┬────────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
├───────────────────┼────┼─────────┼───────┼────────┼─────────┼────────┼─────┼────────────┼──────────┤
│ hypernova_service │ 0 │ cluster │ 17209 │ online │ 39 │ 4h │ 0% │ 296.7 MB │ disabled │
│ hypernova_service │ 1 │ cluster │ 16607 │ online │ 39 │ 2h │ 0% │ 194.2 MB │ disabled │
│ hypernova_service │ 2 │ cluster │ 18864 │ online │ 39 │ 3h │ 0% │ 264.4 MB │ disabled │
└───────────────────┴────┴─────────┴───────┴────────┴─────────┴────────┴─────┴────────────┴──────────┘
$ pm2-zabbix --discover
(node:2227425) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
at emitCircularRequireWarning (node:internal/modules/cjs/loader:834:11)
at Object.get (node:internal/modules/cjs/loader:850:5)
at Object._register [as register] (/usr/lib/node_modules/pm2-zabbix/node_modules/shelljs/src/common.js:455:12)
at Object. (/usr/lib/node_modules/pm2-zabbix/node_modules/shelljs/src/cat.js:4:8)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
Version details:
PM2 version 5.3.0
pm2-zabbix 0.3.2
Node v18.16.0
Ubuntu 20.04.1 LTS
Fix
open package.json file from pm2-zabbix folder (/usr/lib/node_modules/pm2-zabbix/)
Replace pm2 version "^2.1.0" with the installed version "^5.3.0". In my case pm2 version installed is 5.3.0.
Add shelljs with version "^0.8.5".
For eg. package.json looks like
"pm2": "^5.3.0",
"shelljs": "^0.8.5",
Update package.json file with above values to fix the issue.
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
Great module, however I've had issues getting it to work in our environment. Just fixed it and wanted to share:
Reason being, 'zabbix' user invoking sudo would not use the correct .pm2 home directory for user 'testing', and would instead use /root/.pm2, trying to create a new instance of PM2(obviously failing) and causing "Value should be a JSON object" on Zabbix server. Invoking "sudo -u testing /usr/bin/pm2-zabbix --discover" manually as zabbix user with shell worked fine, and it would use correct PM2 instance + pull correct values. Starting "pm2-zabbix --monitor" as user 'testing' would partially fail with:
[ OK ] Periodic sending of PM2 status succeeded
[ ERR ] Periodic sending of process list error: { [Error: Command failed: /usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -
]
killed: false,
code: 2,
signal: null,
cmd: '/usr/bin/zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file -' }
Not sure what's going on there, but #2 fixed it for me. Used zabbix_agentd L4 logs to figure it out. Error produced in the log was:
fs.js:647
return binding.mkdir(pathModule._makeLong(path),
^
Error: EACCES, permission denied '/root/.pm2'
at Object.fs.mkdirSync (fs.js:647:18)
at Object.CLI.pm2Init (/usr/local/lib/node_modules/pm2/lib/CLI.js:37:8)
at Object. (/usr/local/lib/node_modules/pm2/bin/pm2:20:5)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
i have error while run pm2-zabbix --monitor
{"name":"pm2-zabbix","hostname":"wowza","pid":32726,"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":"2018-07-24T03:35:19.382Z","v":0}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.