diff --git a/.vscode/launch.json b/.vscode/launch.json
index 38e142f..770a625 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -1,27 +1,28 @@
{
- // Use IntelliSense to find out which attributes exist for C# debugging
- // Use hover for the description of the existing attributes
- // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
+ // Usare IntelliSense per individuare gli attributi esistenti per il debug C#
+ // Usa il passaggio del mouse per la descrizione degli attributi esistenti
+ // Per ulteriori informazioni, visitare https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
- // If you have changed target frameworks, make sure to update the program path.
- "program": "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Metrics.Exporter/bin/Debug/net6.0/cv4pve-metrics-exporter.dll",
- "args": [],
+ // Se i framework di destinazione sono stati modificati, assicurarsi di aggiornare il percorso del programma.
+ "program": "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Metrics.Exporter/bin/Debug/net8.0/cv4pve-metrics-exporter.dll",
+ "args": [
+ "@Parm.parm"
+ ],
"cwd": "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Metrics.Exporter",
- // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
+ // Per ulteriori informazioni sul campo 'console', vedere https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
- "request": "attach",
- "processId": "${command:pickProcess}"
+ "request": "attach"
}
]
}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 3c359ee..678227d 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -7,9 +7,9 @@
"type": "process",
"args": [
"build",
- "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Metrics.Exporter/Corsinvest.ProxmoxVE.Metrics.Exporter.csproj",
+ "${workspaceFolder}/Corsinvest.ProxmoxVE.Metrics.Exporter.sln",
"/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
+ "/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
@@ -19,9 +19,9 @@
"type": "process",
"args": [
"publish",
- "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Metrics.Exporter/Corsinvest.ProxmoxVE.Metrics.Exporter.csproj",
+ "${workspaceFolder}/Corsinvest.ProxmoxVE.Metrics.Exporter.sln",
"/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
+ "/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
@@ -32,9 +32,8 @@
"args": [
"watch",
"run",
- "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Metrics.Exporter/Corsinvest.ProxmoxVE.Metrics.Exporter.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
+ "--project",
+ "${workspaceFolder}/Corsinvest.ProxmoxVE.Metrics.Exporter.sln"
],
"problemMatcher": "$msCompile"
}
diff --git a/src/Corsinvest.ProxmoxVE.Metrics.Exporter.Api/Corsinvest.ProxmoxVE.Metrics.Exporter.Api.csproj b/src/Corsinvest.ProxmoxVE.Metrics.Exporter.Api/Corsinvest.ProxmoxVE.Metrics.Exporter.Api.csproj
index d97694b..1b4a26a 100644
--- a/src/Corsinvest.ProxmoxVE.Metrics.Exporter.Api/Corsinvest.ProxmoxVE.Metrics.Exporter.Api.csproj
+++ b/src/Corsinvest.ProxmoxVE.Metrics.Exporter.Api/Corsinvest.ProxmoxVE.Metrics.Exporter.Api.csproj
@@ -3,7 +3,7 @@
net6.0
true
- 1.4.2
+ 1.5.0
Corsinvest Srl
Daniele Corsini
Corsinvest Srl
@@ -34,7 +34,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Corsinvest.ProxmoxVE.Metrics.Exporter.Api/InfluxDBExporter.cs b/src/Corsinvest.ProxmoxVE.Metrics.Exporter.Api/InfluxDBExporter.cs
new file mode 100644
index 0000000..6d903a8
--- /dev/null
+++ b/src/Corsinvest.ProxmoxVE.Metrics.Exporter.Api/InfluxDBExporter.cs
@@ -0,0 +1,186 @@
+// /*
+// * SPDX-License-Identifier: GPL-3.0-only
+// * SPDX-FileCopyrightText: 2019 Copyright Corsinvest Srl
+// */
+
+// using System;
+// using System.Collections.Generic;
+// using System.Diagnostics;
+// using System.IO;
+// using System.Linq;
+// using System.Threading.Tasks;
+// using Corsinvest.ProxmoxVE.Api;
+// using Corsinvest.ProxmoxVE.Api.Extension;
+// using Corsinvest.ProxmoxVE.Api.Extension.Utils;
+// using Corsinvest.ProxmoxVE.Api.Shared.Models.Access;
+// using Corsinvest.ProxmoxVE.Api.Shared.Models.Cluster;
+// using Corsinvest.ProxmoxVE.Api.Shared.Models.Node;
+// using Corsinvest.ProxmoxVE.Api.Shared.Models.Vm;
+// using Corsinvest.ProxmoxVE.Api.Shared.Utils;
+// using InfluxDB.Collector;
+// using JsonSubTypes;
+// using Microsoft.Extensions.Logging;
+// using static Corsinvest.ProxmoxVE.Api.PveClient.PveAccess;
+
+// namespace Corsinvest.ProxmoxVE.Metrics.Exporter.Api;
+
+// ///
+// /// InfluxDB Exporter
+// ///
+// public class InfluxDBExporter
+// {
+// private readonly string _pveHostsAndPortHA;
+// private readonly string _pveUsername;
+// private readonly string _pvePassword;
+// private readonly string _pveApiToken;
+// private readonly ILoggerFactory _loggerFactory;
+// private readonly string _url;
+// private readonly string _database;
+
+// ///
+// /// Constructor
+// ///
+// ///
+// ///
+// ///
+// ///
+// ///
+// ///
+// ///
+// public InfluxDBExporter(string pveHostsAndPortHA,
+// string pveUsername,
+// string pvePassword,
+// string pveApiToken,
+// ILoggerFactory loggerFactory,
+// string url,
+// string database)
+// {
+// _pveHostsAndPortHA = pveHostsAndPortHA;
+// _pveUsername = pveUsername;
+// _pvePassword = pvePassword;
+// _pveApiToken = pveApiToken;
+// _loggerFactory = loggerFactory;
+// _url = url;
+// _database = database;
+// }
+
+// ///
+// /// Send async data
+// ///
+// ///
+// public async Task SendAsync()
+// {
+// var stopwatch = new Stopwatch();
+// stopwatch.Start();
+
+// var client = ClientHelper.GetClientFromHA(_pveHostsAndPortHA);
+// client.LoggerFactory = _loggerFactory;
+// if (string.IsNullOrWhiteSpace(_pveApiToken))
+// {
+// await client.Login(_pveUsername, _pvePassword);
+// }
+// //await CollectAsync2(client);
+
+// stopwatch.Stop();
+// }
+
+// private async Task CollectAsync1x(PveClient client)
+// {
+// var collector = new CollectorConfiguration()
+// // .Tag.With("host", Environment.GetEnvironmentVariable("COMPUTERNAME"))
+// // .Tag.With("os", Environment.GetEnvironmentVariable("OS"))
+// //.Tag.With("process", Path.GetFileName(process.MainModule.FileName))
+// .Batch.AtInterval(TimeSpan.FromSeconds(10))
+// .WriteTo.InfluxDB(_url, _database)
+// .CreateCollector();
+
+// var resources = await client.Cluster.Resources.Get();
+
+// foreach (var node in await client.Nodes.Get())
+// {
+// collector.Write("system", new Dictionary()
+// {
+// {"object", "nodes"},
+// {"host", node.Node},
+// {"uptime", node.Uptime},
+// {"status", node.Status},
+// {"cpu", node.CpuUsagePercentage},
+// {"cpus", node.CpuSize},
+// {"mem", node.MemoryUsage},
+// {"maxmem", node.MemorySize},
+// });
+
+// //storages
+// foreach (var storage in await client.Nodes[node.Node].Storage.Get())
+// {
+// var data = new Dictionary
+// {
+// { "active", storage.Active },
+// { "avail", storage.Available },
+// { "content", storage.Content },
+// { "enabled", storage.Enabled },
+// { "host", storage.Storage },
+// { "nodename", node.Node },
+// { "shared", storage.Shared },
+// { "total", storage.Size },
+// { "used", storage.Used }
+// };
+
+// if (!string.IsNullOrWhiteSpace(storage.Type)) { data.Add("type", storage.Type); }
+
+// collector.Write("system", data);
+// }
+
+// //qemu/lxc
+// foreach (var vm in resources.Where(a => a.ResourceType == ClusterResourceType.Vm))
+// {
+// VmBaseStatusCurrent status = vm.VmType switch
+// {
+// VmType.Lxc => await client.Nodes[node.Node].Lxc[vm.VmId].Status.Current.Get(),
+// VmType.Qemu => await client.Nodes[node.Node].Qemu[vm.VmId].Status.Current.Get(),
+// _ => throw new ArgumentOutOfRangeException(),
+// };
+
+// var data = new Dictionary
+// {
+// {"vmid", status.VmId},
+// {"host", node.Node},
+// {"uptime", status.Uptime},
+// {"status", status.Status},
+// {"cpu", status.CpuUsagePercentage},
+// {"cpus", status.CpuSize},
+// {"diskread", status.DiskRead},
+// {"diskwrite", status.DiskWrite},
+// {"mem", status.MemoryUsage},
+// {"maxmem", status.MemorySize},
+// {"disk", status.DiskUsage},
+// {"maxdisk", status.DiskSize},
+// {"netin", status.NetIn},
+// {"netout", status.NetOut},
+// {"pid", status.Pid},
+// {"lock", vm.IsLocked ? 1:0},
+// };
+
+// if (vm.VmType == VmType.Qemu)
+// {
+// var qmStatus = (VmQemuStatusCurrent)status;
+// data.Add("balloon", qmStatus.Balloon);
+// data.Add("qmstatus", qmStatus.Qmpstatus);
+// data.Add("running-qemu", qmStatus.RunningQemu);
+// data.Add("running-machine", qmStatus.RunningMachine);
+
+// //uèdate data from agent
+// try
+// {
+// var aa = await client.Nodes[node.Node].Qemu[vm.VmId].Agent.GetFsinfo.Get();
+// data["disk"] = aa.Result.Select(a => a.UsedBytes).Sum();
+// data["maxdisk"] = aa.Result.Select(a => a.TotalBytes).Sum();
+// }
+// catch { }
+// }
+
+// collector.Write("system", data);
+// }
+// }
+// }
+// }
\ No newline at end of file
diff --git a/src/Corsinvest.ProxmoxVE.Metrics.Exporter/Corsinvest.ProxmoxVE.Metrics.Exporter.csproj b/src/Corsinvest.ProxmoxVE.Metrics.Exporter/Corsinvest.ProxmoxVE.Metrics.Exporter.csproj
index 3697a1f..91c2a35 100644
--- a/src/Corsinvest.ProxmoxVE.Metrics.Exporter/Corsinvest.ProxmoxVE.Metrics.Exporter.csproj
+++ b/src/Corsinvest.ProxmoxVE.Metrics.Exporter/Corsinvest.ProxmoxVE.Metrics.Exporter.csproj
@@ -1,8 +1,8 @@
Exe
- 1.4.1
- net6.0
+ 1.5.0
+ net8.0
cv4pve-metrics-exporter
Corsinvest Srl
Daniele Corsini
@@ -18,9 +18,8 @@
-
+
-
-
+
\ No newline at end of file