Update readme.

This commit is contained in:
unifi-poller-bot 2019-06-12 20:39:09 -07:00
parent 023f5749b0
commit 0f47a79ac7
2 changed files with 13 additions and 6 deletions

View File

@ -13,7 +13,7 @@ unifi-poller(1) -- Utility to poll UniFi Controller Metrics and store them in In
## OPTIONS ## OPTIONS
`unifi-poller [-c <config-file>] [-h] [-v]` `unifi-poller [-c <config-file>] [-j <filter>] [-h] [-v]`
-c, --config <config-file> -c, --config <config-file>
Provide a configuration file (instead of the default). 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 -v, --version
Display version and exit. Display version and exit.
-j, --dumpjson <filter>
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 -h, --help
Display usage and exit. Display usage and exit.

View File

@ -21,7 +21,7 @@ func (c *Config) DumpJSON(filter string) error {
return err return err
} }
controller.ErrorLog = func(m string, v ...interface{}) { 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. } // Log all errors to stderr.
switch sites, err := filterSites(controller, c.Sites); { 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. // DumpClientsJSON prints the raw json for clients in a Unifi Controller.
func (c *Config) DumpClientsJSON(sites []unifi.Site, controller *unifi.Unifi) error { func (c *Config) DumpClientsJSON(sites []unifi.Site, controller *unifi.Unifi) error {
for _, s := range sites { for _, s := range sites {