私の連絡先情報
郵便メール:
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 と負荷平均の 2 つの状態のみを監視します。
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) トリガーを作成する