Sunucu sağlık metriklerini al
curl --request GET \
--url http://localhost:3000/app/metrics \
--header 'Authorization: Basic <encoded-value>'import requests
url = "http://localhost:3000/app/metrics"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('http://localhost:3000/app/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/app/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/app/metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:3000/app/metrics")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/app/metrics")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"status": 200,
"code": "SUCCESS",
"message": "Fetch app metrics success",
"results": {
"version": "v9.6.0",
"session_store": "sqlite",
"devices": {
"total": 5,
"logged_in": 3,
"connected": 3
},
"system": {
"started_at": "2023-11-07T05:31:56Z",
"uptime_seconds": 3600,
"go_version": "go1.26.9",
"cpu_seconds": 17.9,
"memory": {
"heap_alloc_bytes": 123,
"runtime_sys_bytes": 123,
"process_rss_bytes": 123,
"container_bytes": 123,
"container_limit_bytes": 123,
"goroutines": 123,
"gc_cycles": 123
},
"folders": {},
"filesystem": {
"total_bytes": 123,
"free_bytes": 123
}
}
}
}app
Sunucu sağlık metriklerini al
İşlemin ve kapsayıcısının belleği (önce cgroup v2, ardından v1), CPU süresi, statics/media ve storages boyutu (dizin taraması bir dakika önbelleğe alınır), birimdeki boş alan, oturum deposu ve kayıtlı, oturum açmış ve bağlı cihaz sayıları. Cihaz gerektirmez. Null olabilen alanlar, mevcut platformda (Linux dışı) bilinmeyen veya sınırsız (kapsayıcı bellek sınırı) değerleri gösterir. Klasör kullanımı mümkün olduğu ölçüde hesaplanır: eksik veya okunamayan girdiler atlanır ve sembolik bağlantı hedefleri taranmaz. Kapsayıcı metrikleri standart /sys/fs/cgroup bağlama noktasını kullanır ve kullanılamadığında null olur. Çalışma süresi, işlemin başlatılmasını da kapsar.
GET
/
app
/
metrics
Sunucu sağlık metriklerini al
curl --request GET \
--url http://localhost:3000/app/metrics \
--header 'Authorization: Basic <encoded-value>'import requests
url = "http://localhost:3000/app/metrics"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('http://localhost:3000/app/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/app/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/app/metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:3000/app/metrics")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/app/metrics")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"status": 200,
"code": "SUCCESS",
"message": "Fetch app metrics success",
"results": {
"version": "v9.6.0",
"session_store": "sqlite",
"devices": {
"total": 5,
"logged_in": 3,
"connected": 3
},
"system": {
"started_at": "2023-11-07T05:31:56Z",
"uptime_seconds": 3600,
"go_version": "go1.26.9",
"cpu_seconds": 17.9,
"memory": {
"heap_alloc_bytes": 123,
"runtime_sys_bytes": 123,
"process_rss_bytes": 123,
"container_bytes": 123,
"container_limit_bytes": 123,
"goroutines": 123,
"gc_cycles": 123
},
"folders": {},
"filesystem": {
"total_bytes": 123,
"free_bytes": 123
}
}
}
}