ZabbixClient 6.0.3

dotnet add package ZabbixClient --version 6.0.3                
NuGet\Install-Package ZabbixClient -Version 6.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZabbixClient" Version="6.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ZabbixClient --version 6.0.3                
#r "nuget: ZabbixClient, 6.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ZabbixClient as a Cake Addin
#addin nuget:?package=ZabbixClient&version=6.0.3

// Install ZabbixClient as a Cake Tool
#tool nuget:?package=ZabbixClient&version=6.0.3                

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 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 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.0.3 218 1/3/2024
6.0.2 137 1/3/2024
6.0.1 140 11/20/2023