commti after qwen start

This commit is contained in:
mariano
2026-05-22 13:55:01 +02:00
parent ba2293102d
commit ad42773519
15 changed files with 2503 additions and 0 deletions
@@ -0,0 +1,22 @@
#!/usr/bin/env php
<?php
// /usr/share/glpi_agent/plugins/netconfig_backup.php
require_once '/path/to/glpi/vendor/autoload.php';
use PluginNetconfig\Api\GlpiApiClient;
// Carica config da YAML/JSON
$devices = yaml_parse_file('/etc/glpi-agent/netconfig_devices.yaml')['devices'] ?? [];
$api = new GlpiApiClient(
baseUrl: getenv('GLPI_URL') ?: 'http://localhost/glpi',
appToken: getenv('GLPI_APP_TOKEN'),
userToken: getenv('GLPI_USER_TOKEN') // Più sicuro di username/password
);
foreach ($devices as $device) {
$config = fetchConfigViaNetmikoPhp($device); // Funzione custom con phpseclib3
if ($config) {
$api->sendConfig($device['glpi_id'], $config, getenv('NETCONFIG_AGENT_TOKEN'));
}
}