C# Zabbix Api to retrieve and modify the configuration of Zabbix
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:
On the Package Manager Cosole type this to install:
Install-Package Zabbix
Ajust the parameters on the config file:
<configuration>
<appSettings>
<add key="ZabbixApi.url" value="http://myZabbixServer/zabbix/api_jsonrpc.php" />
<add key="ZabbixApi.user" value="Admin" />
<add key="ZabbixApi.password" value="zabbix" />
</appSettings>
</configuration>
Instantiate the context and the service that you want and call the operation:
using(var context = new Context())
{
var service = new HostService(context);
var host = service.GetByName("myHost");
}
You can make your own query too, like that:
using(var context = new Context())
{
var service = new HostService(context);
var host = service.Get(new {
name = "myHost"
});
}
Or that:
using (var context = new Context())
{
var service = new HostService(context);
var host2 = service.Get(new
{
hostid = "1"
});
}