내 연락처 정보
우편메소피아@프로톤메일.com
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 #查询是否已经开启服务
브라우저에 http://192.168.10.50:3000을 입력하세요.
계정/비밀번호:admin/admin
그런 다음 플러그인 인터페이스로 돌아가면 zabbix가 설치되었습니다.
여기서는 CPU와 로드 평균의 두 가지 상태만 모니터링합니다.
CPU 코어 수를 직접 수정할 수는 없습니다. 먼저 다음을 수행해야 합니다.
이런 방식으로 CPU 수를 모니터링할 수 있습니다.
이후의 작업은 일반적으로 동일합니다. 먼저 아이콘 위의 키워드를 찾아 다시 입력하세요.
최종 결과는 이렇습니다
Zabbix에 비해 구체적인 상태를 관찰하기 쉽습니다
nginx 모니터링을 구현하려면 먼저 다음 구성이 있어야 합니다.--with-http 스텁 상태 모듈
- 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
nginx 상태를 감지하는 스크립트
- #!/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
상태를 볼 수 있는지 확인
- vim nginx_state.conf
-
- UserParameter=nginx.status[*],/etc/zabbix/zabbix_agent2.d/nginx_status.sh $1
(1) 템플릿 생성
(2) 모니터링 항목 생성
(3) 트리거 생성