maxshen29 / ZabbixApi

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:MIT License


Languages

Language:C# 99.9%Language:Shell 0.1%