Zabbix: Method for adding Node. js monitoring, zabbixnode. js monitoring

Source: Internet
Author: User

Zabbix: Method for adding Node. js monitoring, zabbixnode. js monitoring

Currently there are pm2-zabbix tools available on the Internet to achieve Zabbix Node. js monitoring alarm, Github address.

Features:

Node. js processes managed by pm2.

Report the Nodes. js Process status, CPU usage, memory usage, and whether the process is restarted.

Monitors the status, resource usage, and pid changes of the PM2 daemon.

An easy-to-install Zabbix metric item template is provided.

1. Install pm2-zabbix on Node. js Server

npm install -g pm2-zabbix

Test whether the automatic detection function is normal:

pm2-zabbix --discover

A similar output indicates that the installation is successful:

{"data": [{"{#PROCESS_ID}": "qb_node-0","{#PROCESS_NAME}": "qb_node"},{"{#PROCESS_ID}": "qb_node-1","{#PROCESS_NAME}": "qb_node"},{"{#PROCESS_ID}": "qb_node-2","{#PROCESS_NAME}": "qb_node"},{"{#PROCESS_ID}": "qb_node-3","{#PROCESS_NAME}": "qb_node"}]}

2. Clone code

Git clonehttps: // github.com/greatcare/pm2-zabbix.git

3. Zabbix Web management background import template file pm2-zabbix/install/zabbix-server/pm2-zabbix.template.xml

4. Add a service to the Node. js server, select the service version based on the server operating system version, and modify the service running user to be consistent with the Node. js user started with pm2.

RHEL/CentOS 7 Series:

cp pm2-zabbix/install/init/systemd/pm2-zabbix.service /usr/lib/systemd/system/

Modify the destination file pm2-zabbix.service file content User item:

User = root

RHEL/CentOS 6 or 5 Series:

cp pm2-zabbix/install/init/sysv/pm2-zabbix /etc/init.d/

Modify the DAEMON_USER item in the pm2-zabbix file of the target file:

DAEMON_USER = root

5. Create a soft connection and modify the actual file path to which the soft connection points based on your server.

mkdir -p /etc/zabbixln -s /App/zabbix/etc/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.confln -s /App/zabbix/bin/zabbix_sender /usr/bin/zabbix_senderln -s `which node` /usr/bin/nodeln -s `which pm2-zabbix` /usr/local/bin/pm2-zabbix

6. Start the pm2-zabbix Service

RHEL/CentOS 7 Series:

Systemctl start pm2-zabbix

RHEL/CentOS 6 or 5 Series:

Service start pm2-zabbix

7. Modify the Zabbix Agent configuration file zabbix_agentd.conf and add other configurations.

Include=/App/zabbix/etc/zabbix_agentd.conf.d/*.conf

8. Copy Zabbix Agent Configuration

cp pm2-zabbix/install/zabbix-agent/pm2-zabbix.conf /App/zabbix/etc/zabbix_agentd.conf.d/pm2.conf

9. modify the configuration pm2.conf content sudo-u user and step 4th are consistent, colleagues modify the pm2-zabbix path

UserParameter=pm2.processes,sudo -u root /usr/local/bin/pm2-zabbix --discover

10. Add the sudo configuration for the server terminal to execute the program mongodo.

zabbix ALL=(ALL:ALL) NOPASSWD: /usr/local/bin/pm2-zabbixDefaults:zabbix !requiretty

11. Restart the Node. js server Zabbix Agent service.

/etc/init.d/zabbix_agentd restart

12. zabbix Web management backend Node settings. js server add link Template App PM2 Template PM2 daemon CPU usage PM2 daemon memory usage PM2 managed Node process instance CPU usage PM2 managed Node process instance memory usage

The above section describes how to add Node. js monitoring to Zabbix. I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.