Skip to content

devopsdunkin/gonagios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GOnagios

CircleCI

Go client for managing endpoints in Nagios XI

Installing

go get -u github.com/devopsdunkin/gonagios

Example

package main

import (
    "log"

    "github.com/devopsdunkin/gonagios"
)

func main() {
    url := "https://nagios.domain.local/nagiosxi"
    token := "token123"
    client := gonagios.NewClient(url, token)

    hostContacts := make([]interface{}, 1)
    hostTemplates := make([]interface{}, 1)
    hostContacts[0] = "nagiosadmin"
    hostTemplates[0] = "generic-host"

    host := &Host{
        HostName:             "host1",
        Alias:                "host1",
        Address:              "192.168.1.1",
        MaxCheckAttempts:     "5",
        CheckPeriod:          "24x7",
        NotificationInterval: "10",
        NotificationPeriod:   "24x7",
        Contacts:             hostContacts,
        Templates:            hostTemplates,
    }

    _, err := client.NewHost()

    if err != nil {
        log.Fatal(err)
    }

    _, err := client.DeleteHost(host.HostName)

    if err != nil {
        log.Fatal(err)
    }
}

About

Go client for managing Nagios XI

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages