file formatting fixes
This commit is contained in:
parent
0f0398d7a7
commit
c811ebc1bb
|
|
@ -81,7 +81,8 @@ documentation support. This project succeeds because of them. Thank you!
|
|||
</p>
|
||||
|
||||
## Copyright & License
|
||||
|
||||
<img style="float: right;" align="right" width="200px" src="https://unpoller.com/img/unpoller.png">
|
||||
|
||||
- Copyright © 2018-2020 David Newhall II.
|
||||
- See [LICENSE](LICENSE) for license information.
|
||||
- Copyright © 2018-2020 David Newhall II.
|
||||
- See [LICENSE](LICENSE) for license information.
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ This module ties the inputs together with the outputs.
|
|||
|
||||
Aggregates metrics on request. Provides CLI app and args parsing.
|
||||
|
||||
|
||||
# Ideal
|
||||
## Ideal
|
||||
|
||||
This library has no notion of "UniFi" or controllers, or Influx, or Prometheus.
|
||||
This library simply provides an input interface and an output interface.
|
||||
|
|
@ -17,10 +16,10 @@ Cisco gear, or any other network (or even non-network) data. The existing plugin
|
|||
should provide ample example of how to use this library, but at some point the
|
||||
godoc will improve.
|
||||
|
||||
# Features
|
||||
## Features
|
||||
|
||||
- Automatically unmarshal's plugin config structs from config file and/or env variables.
|
||||
- Initializes all "imported" plugins on startup.
|
||||
- Provides input plugins a Logger, requires an interface for Metrics and Events retrieval.
|
||||
- Provides Output plugins an interface to retrieve Metrics and Events, and a Logger.
|
||||
- Provides automatic aggregation of Metrics and Events from multiple sources.
|
||||
- Automatically unmarshal's plugin config structs from config file and/or env variables.
|
||||
- Initializes all "imported" plugins on startup.
|
||||
- Provides input plugins a Logger, requires an interface for Metrics and Events retrieval.
|
||||
- Provides Output plugins an interface to retrieve Metrics and Events, and a Logger.
|
||||
- Provides automatic aggregation of Metrics and Events from multiple sources.
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ adding methods to update data, and I'm okay with that. I'll even help add them.
|
|||
Pull requests, feature requests, code reviews and feedback are welcomed!
|
||||
|
||||
Here's a working example:
|
||||
|
||||
```golang
|
||||
package main
|
||||
|
||||
|
|
@ -21,44 +22,44 @@ import "log"
|
|||
import "github.com/unpoller/unpoller/core/unifi"
|
||||
|
||||
func main() {
|
||||
c := *unifi.Config{
|
||||
User: "admin",
|
||||
Pass: "superSecret1234",
|
||||
URL: "https://127.0.0.1:8443/",
|
||||
// Log with log.Printf or make your own interface that accepts (msg, fmt)
|
||||
ErrorLog: log.Printf,
|
||||
DebugLog: log.Printf,
|
||||
}
|
||||
uni, err := unifi.NewUnifi(c)
|
||||
if err != nil {
|
||||
log.Fatalln("Error:", err)
|
||||
}
|
||||
c := *unifi.Config{
|
||||
User: "admin",
|
||||
Pass: "superSecret1234",
|
||||
URL: "https://127.0.0.1:8443/",
|
||||
// Log with log.Printf or make your own interface that accepts (msg, fmt)
|
||||
ErrorLog: log.Printf,
|
||||
DebugLog: log.Printf,
|
||||
}
|
||||
uni, err := unifi.NewUnifi(c)
|
||||
if err != nil {
|
||||
log.Fatalln("Error:", err)
|
||||
}
|
||||
|
||||
sites, err := uni.GetSites()
|
||||
if err != nil {
|
||||
log.Fatalln("Error:", err)
|
||||
}
|
||||
clients, err := uni.GetClients(sites)
|
||||
if err != nil {
|
||||
log.Fatalln("Error:", err)
|
||||
}
|
||||
devices, err := uni.GetDevices(sites)
|
||||
if err != nil {
|
||||
log.Fatalln("Error:", err)
|
||||
}
|
||||
sites, err := uni.GetSites()
|
||||
if err != nil {
|
||||
log.Fatalln("Error:", err)
|
||||
}
|
||||
clients, err := uni.GetClients(sites)
|
||||
if err != nil {
|
||||
log.Fatalln("Error:", err)
|
||||
}
|
||||
devices, err := uni.GetDevices(sites)
|
||||
if err != nil {
|
||||
log.Fatalln("Error:", err)
|
||||
}
|
||||
|
||||
log.Println(len(sites), "Unifi Sites Found: ", sites)
|
||||
log.Println(len(clients), "Clients connected:")
|
||||
for i, client := range clients {
|
||||
log.Println(i+1, client.ID, client.Hostname, client.IP, client.Name, client.LastSeen)
|
||||
}
|
||||
log.Println(len(sites), "Unifi Sites Found: ", sites)
|
||||
log.Println(len(clients), "Clients connected:")
|
||||
for i, client := range clients {
|
||||
log.Println(i+1, client.ID, client.Hostname, client.IP, client.Name, client.LastSeen)
|
||||
}
|
||||
|
||||
log.Println(len(devices.USWs), "Unifi Switches Found")
|
||||
log.Println(len(devices.USGs), "Unifi Gateways Found")
|
||||
log.Println(len(devices.USWs), "Unifi Switches Found")
|
||||
log.Println(len(devices.USGs), "Unifi Gateways Found")
|
||||
|
||||
log.Println(len(devices.UAPs), "Unifi Wireless APs Found:")
|
||||
for i, uap := range devices.UAPs {
|
||||
log.Println(i+1, uap.Name, uap.IP)
|
||||
}
|
||||
log.Println(len(devices.UAPs), "Unifi Wireless APs Found:")
|
||||
for i, uap := range devices.UAPs {
|
||||
log.Println(i+1, uap.Name, uap.IP)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -17,21 +17,21 @@ _This needs a better godoc and examples._
|
|||
|
||||
## Overview
|
||||
|
||||
- Recent logs from poller are visible.
|
||||
- Uptime and Version are displayed across the top.
|
||||
- Recent logs from poller are visible.
|
||||
- Uptime and Version are displayed across the top.
|
||||
|
||||
### Controllers
|
||||
|
||||
- The web server interface allows you to see the configuration for each controller.
|
||||
- Some meta data about each controller is displayed, such as sites, clients and devices.
|
||||
- Example config: [up.json.example](https://github.com/unifi-poller/unifi-poller/blob/master/examples/up.json.example)
|
||||
- The web server interface allows you to see the configuration for each controller.
|
||||
- Some meta data about each controller is displayed, such as sites, clients and devices.
|
||||
- Example config: [up.json.example](https://github.com/unifi-poller/unifi-poller/blob/master/examples/up.json.example)
|
||||
|
||||
### Input Plugins
|
||||
|
||||
- You may view input plugin configuration. Currently only UniFi.
|
||||
- The example config above shows input plugin data.
|
||||
- You may view input plugin configuration. Currently only UniFi.
|
||||
- The example config above shows input plugin data.
|
||||
|
||||
### Output Plugins
|
||||
|
||||
- You may view output plugin configuration. Currently Prometheus and InfluxDB.
|
||||
- The example config above shows output plugin data.
|
||||
- You may view output plugin configuration. Currently Prometheus and InfluxDB.
|
||||
- The example config above shows output plugin data.
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ notification if it changes. The possibilities are endless.
|
|||
|
||||
You must compile your plugin using the unifi-poller source for the version you're
|
||||
using. In other words, to build a plugin for version 2.0.1, do this:
|
||||
```
|
||||
|
||||
```bash
|
||||
mkdir -p $GOPATH/src/github.com/unifi-poller
|
||||
cd $GOPATH/src/github.com/unifi-poller
|
||||
|
||||
|
|
@ -25,4 +26,5 @@ git checkout v2.0.1
|
|||
cp -r <your plugin> plugins/
|
||||
GOOS=linux make plugins
|
||||
```
|
||||
|
||||
The plugin you copy in *must* have a `main.go` file for `make plugins` to build it.
|
||||
|
|
|
|||
Loading…
Reference in New Issue