Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
background
In many companies, there is a phenomenon that there are fewer maintenance servers and no operation and maintenance, but part-time development, so many tools in operation and maintenance are missing. As a new employee, I want to practice the operation and maintenance project and promote the operation and maintenance work. I also asked my operation and maintenance colleagues what the current mainstream operation and maintenance tools are, so I chose targeted tools for practice: Zabbix, Prometheus, etc.
1. Yum install Go, go version check
2. On the monitoring server, install Prometheus: Prometheus. IO/Download/Install other monitoring programs
Modify the Prometheus. yml configuration file:
\ -job \_name: 'node\_exporter' # monitor plugin service static\_configs: \ -targets: \['127.0.0.1:9100'\] # configure listening server IP: port nohup./ Prometheus --config.file= PrometheusCopy the code
3. Install Export on the monitored environment
Download node_exporter for system level monitoring, and other monitoring plug-ins, such as mysql_exporter database monitoring, can be downloaded from Prometheus website
Download binary package, direct tar -zxf decompression, into the directory nohup./node_exporter can run.
Add a service list to systemctl. For example, run the node_exporter plug-in to servier and run the node_exporter service in /etc/systemd/system/node.service:
Description=Prometheus node_exporter # description
ExecStart=/data/node_exporter/node_exporter --log.level=error
ExecStop=/usr/bin/killall node_exporter
MemoryLimit=300M #... 300M
CPUQuota=100% #.. CPU.......Then you need to refresh the configuration: systemctl daemon-reload systemctlenableMysql_exporter lists all services "systemctl list-unit-files --"type=service "lists enabled services" systemctl list-unit-files|grep enabled"Systemctl --failed You can run mysql_exporter, which is a Linux wget download, and run the tar -zxf extract -c to specify a directory that must be run./mysql_exporter can run the mysql_exporter service port, which is configured in the Prometheus configuration file. To do this, you need to create a.my.cnf file in the /root directory, which is very similar to the /etc/my.cnf file and notice that, it says: [root@iZwz9drblb61bve070evy3Z Prometheus]# cat /root/.my.cnf
[root@xxxxxx prometheus]#
Copy the code
4. Install grafana
Wget HTTP: / / https://dl.grafana.com/oss/release/grafana-6.3.5-1.x86\_64.rpm
Sudo yum localinstall grafana 6.3.5-1. X86 \ _64 RPM
Do not modify the configuration file. The configuration path is /etc/grafan/ (default port 3000), which can be accessed from the web. Add the Prometheus data source to download the dashboards panel. Click on the question number in the lower left corner, go to Documentation, select DashBoards, and select the template and load ID required for the actual situation
Import the template ID in Grafana, select the corresponding data source, and you’re happy to monitor.
Blog.csdn.net/csolo/artic…
The w command is used to check whether the number of users connected to the Linux server is the same as the number of users seen in top. Pkill -kill -t