ZabbixClient 6.0.2
See the version list below for details.
dotnet add package ZabbixClient --version 6.0.2
NuGet\Install-Package ZabbixClient -Version 6.0.2
<PackageReference Include="ZabbixClient" Version="6.0.2" />
paket add ZabbixClient --version 6.0.2
#r "nuget: ZabbixClient, 6.0.2"
// Install ZabbixClient as a Cake Addin #addin nuget:?package=ZabbixClient&version=6.0.2 // Install ZabbixClient as a Cake Tool #tool nuget:?package=ZabbixClient&version=6.0.2
ZabbixClient
C# Zabbix Api client to retrieve host data and and modify the configuration of Zabbix
Overview
This is a fork of HenriqueCaires/ZabbixApi with a fix to allow login after Zabbix changes the name of the username property.
Also updated the Newtonsoft.Json dependency to 12.0.3, updated Nuget license, readme and image links and a bump to dotnet 6.
We use the package internally and needed to fix this issue. We have not tested all the endpoints, but the login works and we can retrieve host data.
To allow publishing to NuGet I have renamed the package (and internal namespace) to ZabbixClient.
Todo
- Unit tests fail. This might be our test and prod server returning an empty array, enpoints Zabbix have removed or errors in this client.
- Warning 'WebClient.WebClient()' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.'
- Test automation uses zabbix/zabbix-appliance docker image. This image has been discontinued. Use https://github.com/zabbix/zabbix-docker.git
This library allows you to make CRUD operations using Zabbix API. You just need to instantiate the context and the service that you want and call the operation.Like that:
Installing package
On the Package Manager Cosole type this to install:
Install-Package ZabbixClient
Using
Instantiate the context and the service that you want and call the operation:
using(var context = new Context(url, user, password))
{
var host = context.Hosts.GetByName("myHost");
}
You can make your own query too, like that:
using(var context = new Context(url, user, password))
{
var host = context.Hosts.Get(new {
name = "myHost"
});
}
Or that:
using (var context = new Context(url, user, password))
{
var host2 = context.Hosts.Get(new
{
hostid = "1"
});
}
Configuring via the appsettings.json
file
Instead of specifying the configuration in the constructor the appsettings.json
file can be used like that:
{
"ZabbixClient": {
"url": "http://MyZabbixServer/zabbix/api_jsonrpc.php",
"user": "Admin",
"password": "zabbix"
}
}
The empty constructor can then be used:
using(var context = new Context())
{
// ...
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- Microsoft.Extensions.Configuration (>= 6.0.1)
- Microsoft.Extensions.Configuration.Json (>= 2.1.1)
- Newtonsoft.Json (>= 13.0.3)
- System.Net.Http (>= 4.3.4)
-
net8.0
- Microsoft.Extensions.Configuration (>= 6.0.1)
- Microsoft.Extensions.Configuration.Json (>= 2.1.1)
- Newtonsoft.Json (>= 13.0.3)
- System.Net.Http (>= 4.3.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.