Private
Public Access
1
0

Your descriptive commit message

This commit is contained in:
2026-11-02 01:29:01 +01:00
parent 68043f0416
commit d4bf5b1b0a
4960 changed files with 102120 additions and 46287 deletions

23
test_rrd51.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
require 'vendor/autoload.php';
$app = require_once 'bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$s = Paymenter\Extensions\Servers\Proxmox\Models\Server::find(51);
echo 'VM: ' . $s->vm_id . PHP_EOL;
$node = $s->node->name;
echo 'Node: ' . $node . PHP_EOL;
$p = new Paymenter\Extensions\Servers\Proxmox\Proxmox;
$status = $p->request('/nodes/' . $node . '/qemu/' . $s->vm_id . '/status/current');
$sd = $status->json()['data'] ?? [];
echo 'Status: ' . ($sd['status'] ?? 'unknown') . PHP_EOL;
$resp = $p->request('/nodes/' . $node . '/qemu/' . $s->vm_id . '/rrddata', data: ['timeframe' => 'hour', 'cf' => 'AVERAGE']);
echo 'HTTP: ' . $resp->status() . PHP_EOL;
$data = $resp->json()['data'] ?? [];
echo 'Points: ' . count($data) . PHP_EOL;
if (!empty($data)) {
$last = end($data);
echo 'Keys: ' . implode(', ', array_keys($last)) . PHP_EOL;
foreach(['cpu','mem','maxmem','netin','netout','diskread','diskwrite','time'] as $k) {
echo $k . '=' . ($last[$k] ?? 'NULL') . PHP_EOL;
}
}