avery3888267 / Nagios.NRDP.Client.Net

Nagios NRDP Client for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nagios.NRDP.Client.Net

Nagios.NRDP.Client.Net is a wrapper made for .NET, which works with NRDP (Nagios Remote Data Processor) API.

Links

  • The official NRDP overview documentation
  • See here about configuring API for Nagios XI
  • Nagios start page

Build Status

Build Status

Installation

Installation is performed via NuGet package.

PM> Install-Package Nagios.NRDP.Client.Net

Example

Sending CheckData request to Host and Service:

using Nagios.NRDP.Client.Net.Enums;
using Nagios.NRDP.Client.Net.Models.Request;
using Nagios.NRDP.Client.Net.Models.Response;
using System;
using System.Collections.Generic;

namespace Nagios.NRDP.Client.Net.Example
{
    public class NagiosNrdpExample
    {
        private readonly NagiosNrdpClient _nagiosNrdpClient;

        public NagiosNrdpExample(String apiUrl, String token)
        {
            _nagiosNrdpClient = new NagiosNrdpClient(apiUrl, token);
        }

        public Result SubmitData()
        {
            var host = new Host("Test")
            {
                HostState = HostState.Up,
                StatusData = "Host works fine"
            };

            var service = new Service("Test", "Test Service")
            {
                ServiceState = ServiceState.Critical,
                StatusData = "Critical Error!",
                CheckDatas = new List<CheckData>
                {
                    new CheckData("Ampers", 10.567)
                    {
                        Dimension = "A",
                        WarningScale = 20,
                        ErrorScale = 40,
                        MinScale = 0,
                        MaxScale = 50
                    },
                    new CheckData("Volts", 220.123)
                    {
                        Dimension = "V",
                        MinScale = 0,
                        MaxScale = 340
                    }
                }
            };

            var result = _nagiosNrdpClient.SubmitCheckData(host, service);

            return result;
        }
    }
}

Result of this example API call is bellow:

License

This project is licensed under the MIT license.

About

Nagios NRDP Client for .NET

License:MIT License


Languages

Language:C# 100.0%