diff --git a/config.example.php b/config.example.php index 4c4cc0f..d889c28 100644 --- a/config.example.php +++ b/config.example.php @@ -1,31 +1,94 @@ [ // Key is being used a prometheus key - 'help' => 'Help text for metric', - 'command' => 'The command to be run', - 'jsonelem' => '0.metric', // The json element where the metric is found (Dot notated) - ], - 'app_demo_metric2' => [ - 'help' => 'Help text for metric', - 'http' => [ - 'url' => 'http://example.com', // The url to get collected for the metric - 'data' => 'responsebody', // The body is used as output - ], - 'jsonelem' => '0.metric', - ], - 'app_demo_metric3' => [ - 'help' => 'Help text for metric', - 'http' => [ - 'url' => 'http://example.com', // The url to get collected for the metric - 'data' => 'hasresponse', // If an error occured during request this will return 0, otherwise 1 + '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}\'', + ], ], ], - 'app_demo_metric4' => [ - 'help' => 'Help text for metric', - 'http' => [ - 'url' => 'http://example.com', // The url to get collected for the metric - 'data' => 'responsetime', // This will return the transfer time - 'proxy' => 'http://192.168.1.252:8080', // The proxy server the request needs to use + 'memory_usage' => [ + 'help' => 'Memory usage percentage', + 'type' => 'gauge', + 'submetrics' => [ + [ + 'command' => 'free | grep Mem | awk \'{print $3/$2 * 100.0}\'', + ], ], ], -]; \ No newline at end of file + '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 + ], + ], + ], +];