Coder Social home page Coder Social logo

zabbixclient's Introduction

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())
{
  // ...
}

zabbixclient's People

Contributors

henriquecaires avatar geoweir avatar vbfox avatar andrazjelenc avatar brunocodeman avatar jtone123 avatar chrcraven avatar dovreshef avatar

Stargazers

Алексей Овчинников avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.