commti after qwen start
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user