2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
- 初始化操作
- systemctl disable --now firewalld
- setenforce 0
- vim /etc/selinux/config
- SELINUX=disabled
- cd /opt
- grafana-enterprise-9.4.7-1.x86_64.rpm #上传软件包
- yum localinstall -y grafana-enterprise-9.4.7-1.x86_64.rpm #安装
- systemctl enable --now grafana-server.service #开启服务
- netstat -lntp | grep 3000 #查询是否已经开启服务
Enter http://192.168.10.50:3000 in your browser
Username/password:admin/admin
Then return to the Plugins interface, zabbix has been installed
We only monitor the CPU and load average states here.
To modify the number of CPU cores, you cannot modify it directly. You need to do the following operations first.
This way you can monitor the number of CPUs
The subsequent operations are basically the same. First find the keyword above the icon and then re-enter it.
The final result is like this
Compared with zabbix, it is easier to observe the specific status
To monitor nginx, you must first have this configuration--with-http stub status module
- vim /etc/nginx/conf.d/default.conf
-
- location / {
- root /var/www/zbx;
- index index.php index.html index.htm;
- }
- systemctl reload nginx.service
-
- curl -s http://192.168.10.20/nginx_state
- vim nginx_status.sh
-
- chmod +x nginx_status.sh
-
- ./nginx_status.sh waiting
Script to detect nginx status
- #!/bin/bash
- IP=192.168.10.20
- PORT=80
- STUB_URI=nginx_state
-
- active() {
- curl -s http://$IP:$PORT/$STUB_URI | awk 'NR==1 {print $3}'
- }
-
- accepts() {
- curl -s http://$IP:$PORT/$STUB_URI | awk 'NR==3 {print $1}'
- }
-
- handled() {
- curl -s http://$IP:$PORT/$STUB_URI | awk 'NR==3 {print $2}'
- }
-
- requests() {
- curl -s http://$IP:$PORT/$STUB_URI | awk 'NR==3 {print $3}'
- }
-
- Reading() {
- curl -s http://$IP:$PORT/$STUB_URI | awk 'NR==4 {print $2}'
- }
-
- writing() {
- curl -s http://$IP:$PORT/$STUB_URI | awk 'NR==4 {print $4}'
- }
-
- waiting() {
- curl -s http://$IP:$PORT/$STUB_URI | awk 'NR==4 {print $6}'
- }
-
- process() {
- pidof nginx | wc -w
- }
-
- case $1 in
- active)
- active
- ;;
- accepts)
- accepts
- ;;
- handled)
- handled
- ;;
- requests)
- requests
- ;;
- Reading)
- Reading
- ;;
- Writing)
- writing
- ;;
- Waiting)
- waiting
- ;;
- process)
- process
- ;;
- *)
- echo "Usage: $0 {active|accepts|handled|requests|Reading|writing|waiting|process}" exit 1
- esac
- exit 0
Verify that you can view the status
- vim nginx_state.conf
-
- UserParameter=nginx.status[*],/etc/zabbix/zabbix_agent2.d/nginx_status.sh $1
(1) Create a template
(2) Create monitoring items
(3) Create a trigger