95 lines
2.6 KiB
PHP
95 lines
2.6 KiB
PHP
<?php
|
|
|
|
$config = [
|
|
'cpu_usage' => [
|
|
'help' => 'CPU usage percentage',
|
|
'type' => 'gauge',
|
|
'submetrics' => [
|
|
[
|
|
'command' => 'top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk \'{print 100 - $1}\'',
|
|
],
|
|
],
|
|
],
|
|
'memory_usage' => [
|
|
'help' => 'Memory usage percentage',
|
|
'type' => 'gauge',
|
|
'submetrics' => [
|
|
[
|
|
'command' => 'free | grep Mem | awk \'{print $3/$2 * 100.0}\'',
|
|
],
|
|
],
|
|
],
|
|
'disk_usage' => [
|
|
'help' => 'Disk usage percentage',
|
|
'type' => 'gauge',
|
|
'submetrics' => [
|
|
[
|
|
'command' => 'df -h / | grep / | awk \'{print $5}\' | sed \'s/%//g\'',
|
|
],
|
|
],
|
|
],
|
|
'website_response_time' => [
|
|
'help' => 'Response time of example.com in seconds',
|
|
'type' => 'gauge',
|
|
'submetrics' => [
|
|
[
|
|
'http' => [
|
|
'url' => 'http://example.com',
|
|
'data' => 'responsetime',
|
|
],
|
|
],
|
|
],
|
|
],
|
|
'website_status' => [
|
|
'help' => 'HTTP status code of example.com',
|
|
'type' => 'gauge',
|
|
'submetrics' => [
|
|
[
|
|
'http' => [
|
|
'url' => 'http://example.com',
|
|
'data' => 'hasresponse',
|
|
'statuscode' => [200],
|
|
],
|
|
],
|
|
],
|
|
],
|
|
'http_request_count' => [
|
|
'help' => 'Number of HTTP requests to example.com',
|
|
'type' => 'counter',
|
|
'submetrics' => [
|
|
[
|
|
'http' => [
|
|
'url' => 'http://example.com',
|
|
'data' => 'hasresponse',
|
|
],
|
|
],
|
|
],
|
|
],
|
|
'proxied_request' => [
|
|
'help' => 'Response time of example.com via proxy in seconds',
|
|
'type' => 'gauge',
|
|
'submetrics' => [
|
|
[
|
|
'http' => [
|
|
'url' => 'http://example.com',
|
|
'data' => 'responsetime',
|
|
'proxy' => 'http://your-proxy-server:8080',
|
|
],
|
|
],
|
|
],
|
|
],
|
|
'json_data_metric' => [
|
|
'help' => 'Value from JSON response of example.com',
|
|
'type' => 'gauge',
|
|
'submetrics' => [
|
|
[
|
|
'http' => [
|
|
'url' => 'http://example.com/api/data',
|
|
'data' => 'responsebody',
|
|
],
|
|
'jsonelem' => 'path.to.value', // Adjust the JSON path to the actual structure
|
|
],
|
|
],
|
|
],
|
|
];
|