From 0f47a79ac7d6952fce1d378bb85434656a7ccb72 Mon Sep 17 00:00:00 2001 From: unifi-poller-bot Date: Wed, 12 Jun 2019 20:39:09 -0700 Subject: [PATCH] Update readme. --- integrations/inputunifi/cmd/unifi-poller/README.md | 13 ++++++++++++- .../inputunifi/cmd/unifi-poller/jsondebug.go | 6 +----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/integrations/inputunifi/cmd/unifi-poller/README.md b/integrations/inputunifi/cmd/unifi-poller/README.md index 64bce18e..2b8e8159 100644 --- a/integrations/inputunifi/cmd/unifi-poller/README.md +++ b/integrations/inputunifi/cmd/unifi-poller/README.md @@ -13,7 +13,7 @@ unifi-poller(1) -- Utility to poll UniFi Controller Metrics and store them in In ## OPTIONS -`unifi-poller [-c ] [-h] [-v]` +`unifi-poller [-c ] [-j ] [-h] [-v]` -c, --config Provide a configuration file (instead of the default). @@ -21,6 +21,17 @@ unifi-poller(1) -- Utility to poll UniFi Controller Metrics and store them in In -v, --version Display version and exit. + -j, --dumpjson + This is a debug option; use this when you are missing data in your graphs, + and/or you want to inspect the raw data coming from the controller. The + filter only accept two options: devices or clients. This will print a lot + of information. Recommend piping it into a file and/or into jq for better + visualization. This requires a working config file that; one that contains + working authentication details for a Unifi Controller. This only dumps + data for sites listed in the config file. The application exits after + printing the JSON payload; it does not daemonize or report to InfluxDB + with this option. + -h, --help Display usage and exit. diff --git a/integrations/inputunifi/cmd/unifi-poller/jsondebug.go b/integrations/inputunifi/cmd/unifi-poller/jsondebug.go index 011738bd..be3f86cd 100644 --- a/integrations/inputunifi/cmd/unifi-poller/jsondebug.go +++ b/integrations/inputunifi/cmd/unifi-poller/jsondebug.go @@ -21,7 +21,7 @@ func (c *Config) DumpJSON(filter string) error { return err } controller.ErrorLog = func(m string, v ...interface{}) { - fmt.Fprintf(os.Stderr, m, v...) + fmt.Fprintf(os.Stderr, "[ERROR] "+m, v...) } // Log all errors to stderr. switch sites, err := filterSites(controller, c.Sites); { @@ -36,10 +36,6 @@ func (c *Config) DumpJSON(filter string) error { } } -func errorLog(m string, v ...interface{}) { - fmt.Fprintf(os.Stderr, m, v...) -} - // DumpClientsJSON prints the raw json for clients in a Unifi Controller. func (c *Config) DumpClientsJSON(sites []unifi.Site, controller *unifi.Unifi) error { for _, s := range sites {