هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
Grafana (port 3000) connects to data sources (Prometheus, Loki, Tempo, Elasticsearch, Azure Monitor, PostgreSQL) and shows them in dashboards. It also has alerting, users, teams and SSO (OIDC with Keycloak or Entra ID). In a DevSecOps setup you do not click dashboards by hand: you provision data sources and dashboards from files in Git, or use the HTTP API / Terraform provider.
The CLI is grafana cli (older: grafana-cli). The service is grafana-server.service.
طريقة الكتابة
grafana cli [--homepath DIR] plugins|admin COMMAND
curl -H "Authorization: Bearer TOKEN" http://HOST:3000/api/...الأجزاء الرئيسية
CLI commands
pluginsinstallNAME[VERSION]- Install a plugin.
pluginsls/update-all/removeNAME- Manage plugins.
adminreset-admin-passwordPASS- Reset the admin password.
admindata-migrationencrypt-datasource-passwords- Encrypt old data source passwords.
الخيارات 7
الأكثر استخدامًا
Important settings (grafana.ini or GF_* env vars)
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 11
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1Install on RHEL
2Run in a container
podman run -d --name grafana -p 3000:3000 -e GF_SECURITY_ADMIN_PASSWORD__FILE=/run/secrets/grafana_admin -v grafana-data:/var/lib/grafana docker.io/grafana/grafana:11.3.03Provision a Prometheus data source from a file
cat /etc/grafana/provisioning/datasources/prometheus.yml apiVersion: 1 datasources: - name: Prometheus type: prometheus url: http://localhost:9090 isDefault: true4Provision dashboards from a folder in Git
cat /etc/grafana/provisioning/dashboards/default.yml apiVersion: 1 providers: - name: default folder: Infra options: { path: /var/lib/grafana/dashboards }5Install a plugin
grafana cli plugins install grafana-piechart-panel systemctl restart grafana-server6Reset the admin password
grafana cli admin reset-admin-password 'N3w-Strong-Pass!'7Use the HTTP API with a service account token
8Export a dashboard to JSON for Git
curl -s -H "Authorization: Bearer $GRAFANA_TOKEN" http://localhost:3000/api/dashboards/uid/rYdddlPWk | jq '.dashboard' > dashboards/node.json9Check health
curl -s http://localhost:3000/api/health10Turn on SSO with Keycloak
cat /etc/grafana/grafana.ini [auth.generic_oauth] enabled = true name = Keycloak client_id = grafana client_secret = $__file{/etc/grafana/oauth_secret} auth_url = https://sso.lab.local/realms/lab/protocol/openid-connect/auth token_url = https://sso.lab.local/realms/lab/protocol/openid-connect/token api_url = https://sso.lab.local/realms/lab/protocol/openid-connect/userinfo11Read the logs
journalctl -u grafana-server -n 50
لا يوجد شيء يطابق هذا الفلتر.
انتبه
- Change the default
admin/adminat once and turn off sign-up and anonymous access. - Data source passwords and tokens: use
$__file{}or env vars, never plain text in Git. - Viewers can see all data of a data source — split sensitive data into separate data sources and folders.
الملفات
/etc/grafana/grafana.ini- Main settings.
/etc/grafana/provisioning/- Data sources, dashboards, alerting as files.
/var/lib/grafana/- Database (grafana.db) and plugins.
/var/log/grafana/- Logs.
نصائح للحفظ
- Import community dashboards by ID (1860 Node Exporter Full, 15757 Kubernetes views).
رموز الخروج
0 | Success. |
1 | Error. |