Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
/ ZabbixApi Public archive

C# Zabbix Api to retrieve and modify the configuration of Zabbix

License

Notifications You must be signed in to change notification settings

HenriqueCaires/ZabbixApi

Repository files navigation

ZabbixApi GitHub NuGet Nuget Build Status Total alerts

C# Zabbix Api to retrieve and modify the configuration of Zabbix

Overview

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 Zabbix

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:

{
    "ZabbixApi": {
        "url": "http://MyZabbixServer/zabbix/api_jsonrpc.php",
        "user": "Admin",
        "password": "zabbix"
    }
}

The empty constructor can then be used:

using(var context = new Context())
{
  // ...
}

About

C# Zabbix Api to retrieve and modify the configuration of Zabbix

Resources

License

Stars

Watchers

Forks

Packages