From c811ebc1bbeb154dccb0f393c534d98eaef2b547 Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Wed, 23 Nov 2022 22:08:48 -0600 Subject: [PATCH] file formatting fixes --- README.md | 5 ++- core/poller/README.md | 15 +++---- core/unifi/README.md | 71 ++++++++++++++++--------------- core/webserver/README.md | 18 ++++---- integrations/mysqlunifi/README.md | 4 +- 5 files changed, 58 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 9415fcb6..b2ad05b8 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,8 @@ documentation support. This project succeeds because of them. Thank you!

## Copyright & License + -- Copyright © 2018-2020 David Newhall II. -- See [LICENSE](LICENSE) for license information. +- Copyright © 2018-2020 David Newhall II. +- See [LICENSE](LICENSE) for license information. diff --git a/core/poller/README.md b/core/poller/README.md index c658a12f..76c54f7d 100644 --- a/core/poller/README.md +++ b/core/poller/README.md @@ -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. diff --git a/core/unifi/README.md b/core/unifi/README.md index 0ab8b58b..898e7430 100644 --- a/core/unifi/README.md +++ b/core/unifi/README.md @@ -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) + } } ``` diff --git a/core/webserver/README.md b/core/webserver/README.md index 85364c4c..a1752859 100644 --- a/core/webserver/README.md +++ b/core/webserver/README.md @@ -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. diff --git a/integrations/mysqlunifi/README.md b/integrations/mysqlunifi/README.md index c25e6d9f..4a3379c0 100644 --- a/integrations/mysqlunifi/README.md +++ b/integrations/mysqlunifi/README.md @@ -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 plugins/ GOOS=linux make plugins ``` + The plugin you copy in *must* have a `main.go` file for `make plugins` to build it.