Nagios.NRDP.Client.Net is a wrapper made for .NET, which works with NRDP (Nagios Remote Data Processor) API.
- The official NRDP overview documentation
- See here about configuring API for Nagios XI
- Nagios start page
Installation is performed via NuGet package.
PM> Install-Package Nagios.NRDP.Client.Net
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:
This project is licensed under the MIT license.