forked from newrelic/nri-flex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpm2_linux.yml
54 lines (54 loc) · 1.92 KB
/
pm2_linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Prerequisites for Linux:
# Ensure node and pm2 are available or mapped to root/sudo user at:
# `/usr/local/bin/pm2` & `/usr/local/bin/node`
#
# This is necessary because PM2 runs in non-root mode while Flex requires sudo
#
# Commands to setup mapping
# sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/pm2" "/usr/local/bin/pm2"
# sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node"
#
# For windows and mac simply uncomment the 2nd block with `npx pm2 jlist`
#
# Query the events : `FROM PM2Sample SELECT *`
integrations:
- name: nri-flex
timeout: 60s
interval: 30s
config:
name: PM2status
apis:
- name: PM2Process
event_type: PM2Sample
commands:
- run: USER=ubuntu; su - $USER bash -c "pm2 jlist"
# - run: npx pm2 jlist
jq: >-
[] | {
pid,
name,
pm2_env: {
script: .pm2_env.script?,
out_file: .pm2_env.out_file?,
error_file: .pm2_env.error_file?,
watch: .pm2_env.watch?,
exit_code: .pm2_env.exit_code?,
node_version: .pm2_env.node_version?,
versioning: .pm2_env.versioning?,
version: .pm2_env.version?,
unstable_restarts: .pm2_env.unstable_restarts?,
restart_time: .pm2_env.restart_time?,
created_at: .pm2_env.created_at?,
pm_uptime: .pm2_env.pm_uptime?,
status: .pm2_env.status?,
unique_id: .pm2_env.unique_id?
},
pm_id,
monit
} | del(.pm2_env.versioning.remotes)
remove_keys:
- pm_id
rename_keys:
name: appName
custom_attributes:
hostId: localhost