This commit is contained in:
davidnewhall2 2020-06-29 22:36:05 -07:00
parent b92386518e
commit eacce79785
8 changed files with 88 additions and 73 deletions

View File

@ -24,12 +24,18 @@ examples and default configurations.
OPTIONS OPTIONS
--- ---
`unifi-poller [-c <config-file>,[config-file]] [-j <filter>] [-h] [-v]` `unifi-poller [-c <config-file>,[config-file]] [-j <filter>] [-e <pass>] [-h] [-v]`
-c, --config <config-file>,[config-file] -c, --config <config-file>,[config-file]
Provide a configuration file (instead of the default). You may provide Provide a configuration file (instead of the default). You may provide
multiple file paths separated by commas. The first file found is used. multiple file paths separated by commas. The first file found is used.
-e, --encrypt <password|->
Encrypts a password with bcrypt. This is useful to make an account
password for the built-in web server. You may provide the password
on the CLI, or use "-" as the pass to be prompted for the password
without echo.
-v, --version -v, --version
Display version and exit. Display version and exit.
@ -56,13 +62,14 @@ CONFIGURATION
* Windows: `C:\\ProgramData\\unifi-poller\\up.conf` * Windows: `C:\\ProgramData\\unifi-poller\\up.conf`
* Others: `/etc/unifi-poller/up.conf` * Others: `/etc/unifi-poller/up.conf`
* Config File Default Format: `TOML` * Config File Default Format: `TOML`
* Possible formats: `XML`, `JSON`, `TOML`, `YAML` * Possible formats: `JSON`, `TOML`, `YAML`
The config file can be written in four different syntax formats. The application The config file can be written in four different syntax formats. The application
decides which one to use based on the file's name. If it contains `.xml` it will decides which one to use based on the file's name. If it contains `.json` it will
be parsed as XML. The same goes for `.json` and `.yaml`. If the filename contains be parsed as JSON. The same goes for `.yaml`. If the filename contains neither
none of these strings, then it is parsed as the default format, TOML. This option of these strings, then it is parsed as the default format, TOML. This feature
is provided so the application can be easily adapted to any environment. is provided so the application can be easily adapted to any environment. `XML`
used to work but no longer does.
`Config File Parameters` `Config File Parameters`

View File

@ -3,9 +3,9 @@
This folder contains example configuration files in four This folder contains example configuration files in four
supported formats. You can use any format you want for supported formats. You can use any format you want for
the config file, just give it the appropriate suffix for the config file, just give it the appropriate suffix for
the format. An XML file should end with `.xml`, a JSON the format. A JSON file should end with `.json`, and
file with `.json`, and YAML with `.yaml`. The default YAML with `.yaml`. The default format is always TOML and
format is always TOML and may have any _other_ suffix. may have any _other_ suffix.
#### Dashboards #### Dashboards

View File

@ -43,6 +43,42 @@
# If you're getting zeros now, set this to "1m" # If you're getting zeros now, set this to "1m"
interval = "30s" interval = "30s"
# To enable output of UniFi Events to Loki, add a URL.
# User, pass and tenant_id are optional and most folks wont set them.
# Pick which logs you want per-controller in the [unifi.controller] section.
# This is a new feature. Feedback welcome!
[loki]
url = ""
# The rest of this is advanced & optional.
user = ""
pass = ""
verify_ssl = false
tenant_id = ""
interval = "2m"
timeout = "10s"
# Poller has an optional web server. To turn it on, set enable to true. If you
# wish to use SSL, provide SSL cert and key paths. This interface is currently
# read-only; it just displays information, like logs, devices and clients.
# Notice: Enabling the web server with many clients will increase memory usage.
# This is a new feature. Feedback welcome!
[webserver]
enable = false
port = 37288
# The HTML path is different on Windows and BSD/macOS.
html_path = "/usr/lib/unifi-poller/web"
ssl_cert_path = ""
ssl_key_path = ""
# How many events per source to hold. 200-2000. Use fewer with many clients.
max_events = 200
# By default the web interface does not require authentication. You can change
# that by adding a username and password hash (or multiple) below.
# To create a hash, run unifi-poller with the -e CLI argument.
[webserver.accounts]
# username = "password-hash"
# captain = "$2a$04$mxw6i0LKH6u46oaLK2cq5eCTAAFkfNiRpzNbz.EyvJZZWNa2FzIlS"
#### INPUTS #### INPUTS
[unifi] [unifi]

View File

@ -21,6 +21,18 @@
"interval": "30s" "interval": "30s"
}, },
"webserver": {
"enable": false,
"port": 37288,
"html_path": "/usr/lib/unifi-poller/web",
"ssl_cert_path": ""
"ssl_key_path": ""
"max_events": 200
"accounts": {
"captain": "$2a$04$mxw6i0LKH6u46oaLK2cq5eCTAAFkfNiRpzNbz.EyvJZZWNa2FzIlS"
}
},
"unifi": { "unifi": {
"dynamic": false, "dynamic": false,
"defaults": { "defaults": {

View File

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#############################################
# UniFi Poller primary configuration file. #
# XML FORMAT. Provided values are defaults. #
# See up.conf.example! v2 #
#############################################
NOTE: <plugin> and <site> are lists of strings and may be repeated.
-->
<poller debug="false" quiet="false">
<!-- plugin></plugin -->
<prometheus disable="false">
<http_listen>0.0.0.0:9130</http_listen>
<report_errors>false</report_errors>
</prometheus>
<influxdb disable="false">
<interval>30s</interval>
<url>http://127.0.0.1:8086</url>
<user>unifipoller</user>
<pass>unifipoller</pass>
<db>unifi</db>
<verify_ssl>false</verify_ssl>
</influxdb>
<unifi dynamic="false">
<default>
<site>all</site>
<user>unifipoller</user>
<pass>unifipoller</pass>
<url>https://127.0.0.1:8443</url>
<save_ids>false</save_ids>
<save_events>false</save_events>
<save_alarms>false</save_alarms>
<save_anomalies>false</save_anomalies>
<save_dpi>false</save_dpi>
<save_sites>true</save_sites>
<hash_pii>false</hash_pii>
<verify_ssl>false</verify_ssl>
</default>
<!-- Repeat this stanza to poll additional controllers. -->
<controller>
<site>all</site>
<user>unifipoller</user>
<pass>unifipoller</pass>
<url>https://127.0.0.1:8443</url>
<save_ids>false</save_ids>
<save_events>false</save_events>
<save_alarms>false</save_alarms>
<save_anomalies>false</save_anomalies>
<save_dpi>false</save_dpi>
<save_sites>true</save_sites>
<hash_pii>false</hash_pii>
<verify_ssl>false</verify_ssl>
</controller>
</unifi>
</poller>

View File

@ -24,6 +24,16 @@ influxdb:
db: "unifi" db: "unifi"
verify_ssl: false verify_ssl: false
webserver:
enable: false
port: 37288
html_path: "/usr/lib/unifi-poller/web"
ssl_cert_path: ""
ssl_key_path: ""
max_events: 200
accounts:
captain: "$2a$04$mxw6i0LKH6u46oaLK2cq5eCTAAFkfNiRpzNbz.EyvJZZWNa2FzIlS"
unifi: unifi:
dynamic: false dynamic: false
defaults: defaults:

6
go.mod
View File

@ -15,12 +15,12 @@ require (
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/pflag v1.0.5 // indirect
github.com/unifi-poller/influxunifi v0.0.10-0.20200628212559-02c131d5ab9f github.com/unifi-poller/influxunifi v0.0.10-0.20200628212559-02c131d5ab9f
github.com/unifi-poller/inputunifi v0.0.8-0.20200628124735-b6af0039a275 github.com/unifi-poller/inputunifi v0.0.8-0.20200629074959-35d6603f1831
github.com/unifi-poller/lokiunifi v0.0.0-20200628212531-964d320957e4 github.com/unifi-poller/lokiunifi v0.0.0-20200628212531-964d320957e4
github.com/unifi-poller/poller v0.0.8-0.20200628131550-26430cac16c1 github.com/unifi-poller/poller v0.0.8-0.20200628131550-26430cac16c1
github.com/unifi-poller/promunifi v0.0.9-0.20200628212620-13ccb1ce3beb github.com/unifi-poller/promunifi v0.0.9-0.20200628212620-13ccb1ce3beb
github.com/unifi-poller/unifi v0.0.6-0.20200625090439-421046871a37 github.com/unifi-poller/unifi v0.0.6-0.20200628213309-a22ea217874f
github.com/unifi-poller/webserver v0.0.0-20200628220857-bb444cf7da24 github.com/unifi-poller/webserver v0.0.0-20200630053536-1a5a6430daf4
golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect
golift.io/cnfg v0.0.5 // indirect golift.io/cnfg v0.0.5 // indirect

11
go.sum
View File

@ -118,6 +118,10 @@ github.com/unifi-poller/inputunifi v0.0.8-0.20200628114724-8b60ff573a49 h1:ce5cX
github.com/unifi-poller/inputunifi v0.0.8-0.20200628114724-8b60ff573a49/go.mod h1:Rb9C8xi/qgxOO/IbwyO4Uu77qVkIhGiQv4cA2jnmNMI= github.com/unifi-poller/inputunifi v0.0.8-0.20200628114724-8b60ff573a49/go.mod h1:Rb9C8xi/qgxOO/IbwyO4Uu77qVkIhGiQv4cA2jnmNMI=
github.com/unifi-poller/inputunifi v0.0.8-0.20200628124735-b6af0039a275 h1:pbC+9LglWSAg6EE0AQPxk/Z2WowrVvEzH6cVVi/mcGo= github.com/unifi-poller/inputunifi v0.0.8-0.20200628124735-b6af0039a275 h1:pbC+9LglWSAg6EE0AQPxk/Z2WowrVvEzH6cVVi/mcGo=
github.com/unifi-poller/inputunifi v0.0.8-0.20200628124735-b6af0039a275/go.mod h1:Rb9C8xi/qgxOO/IbwyO4Uu77qVkIhGiQv4cA2jnmNMI= github.com/unifi-poller/inputunifi v0.0.8-0.20200628124735-b6af0039a275/go.mod h1:Rb9C8xi/qgxOO/IbwyO4Uu77qVkIhGiQv4cA2jnmNMI=
github.com/unifi-poller/inputunifi v0.0.8-0.20200629073944-889691ff1096 h1:0e66nCzeonQtrzX/zdNJdQHcoo6z2/rCmUaiAJU0tIM=
github.com/unifi-poller/inputunifi v0.0.8-0.20200629073944-889691ff1096/go.mod h1:iJT8Y3KwSV/ceqOikamlhw2c0EMHTFv47TxKKFThx8I=
github.com/unifi-poller/inputunifi v0.0.8-0.20200629074959-35d6603f1831 h1:fBPfSPtGCmpv5BMwk+oorS672fd7L8vFbX/DTOC+2C4=
github.com/unifi-poller/inputunifi v0.0.8-0.20200629074959-35d6603f1831/go.mod h1:iJT8Y3KwSV/ceqOikamlhw2c0EMHTFv47TxKKFThx8I=
github.com/unifi-poller/lokiunifi v0.0.0-20200626040346-12af563d2a99/go.mod h1:7+uUJT6nnXVPad/Omsj+lPD80Cshg4L8TPUkV72JNM8= github.com/unifi-poller/lokiunifi v0.0.0-20200626040346-12af563d2a99/go.mod h1:7+uUJT6nnXVPad/Omsj+lPD80Cshg4L8TPUkV72JNM8=
github.com/unifi-poller/lokiunifi v0.0.0-20200626052645-b0336442237e h1:MoyVcBNks+p1tYCu67UyQycyHpeCqzafWpjMir/Mjh8= github.com/unifi-poller/lokiunifi v0.0.0-20200626052645-b0336442237e h1:MoyVcBNks+p1tYCu67UyQycyHpeCqzafWpjMir/Mjh8=
github.com/unifi-poller/lokiunifi v0.0.0-20200626052645-b0336442237e/go.mod h1:7+uUJT6nnXVPad/Omsj+lPD80Cshg4L8TPUkV72JNM8= github.com/unifi-poller/lokiunifi v0.0.0-20200626052645-b0336442237e/go.mod h1:7+uUJT6nnXVPad/Omsj+lPD80Cshg4L8TPUkV72JNM8=
@ -149,6 +153,8 @@ github.com/unifi-poller/promunifi v0.0.9-0.20200628212620-13ccb1ce3beb/go.mod h1
github.com/unifi-poller/unifi v0.0.5-0.20200620103801-b927287ea1cd/go.mod h1:L1kMRH2buZhB31vZnRC1im7Tk/4uD3ET4biwl2faYy8= github.com/unifi-poller/unifi v0.0.5-0.20200620103801-b927287ea1cd/go.mod h1:L1kMRH2buZhB31vZnRC1im7Tk/4uD3ET4biwl2faYy8=
github.com/unifi-poller/unifi v0.0.6-0.20200625090439-421046871a37 h1:T2y8JWkjZd1vz2ZKu4vmmAk9s6PUwupuTldwhfww5xY= github.com/unifi-poller/unifi v0.0.6-0.20200625090439-421046871a37 h1:T2y8JWkjZd1vz2ZKu4vmmAk9s6PUwupuTldwhfww5xY=
github.com/unifi-poller/unifi v0.0.6-0.20200625090439-421046871a37/go.mod h1:L1kMRH2buZhB31vZnRC1im7Tk/4uD3ET4biwl2faYy8= github.com/unifi-poller/unifi v0.0.6-0.20200625090439-421046871a37/go.mod h1:L1kMRH2buZhB31vZnRC1im7Tk/4uD3ET4biwl2faYy8=
github.com/unifi-poller/unifi v0.0.6-0.20200628213309-a22ea217874f h1:5aLy4Ac0vFhaEikq04oPAFqhygVv0lq77/ZJ4aBEnkc=
github.com/unifi-poller/unifi v0.0.6-0.20200628213309-a22ea217874f/go.mod h1:uqBaNCon8FTw6nwGsAYHz/HwBgEYepS0XB5XW+OdBts=
github.com/unifi-poller/webserver v0.0.0-20200626113232-24ae3f02067d h1:iTp4YWGqBmDRxsMjLnJymmDzhO9b+Jvjly7hqLJnPdY= github.com/unifi-poller/webserver v0.0.0-20200626113232-24ae3f02067d h1:iTp4YWGqBmDRxsMjLnJymmDzhO9b+Jvjly7hqLJnPdY=
github.com/unifi-poller/webserver v0.0.0-20200626113232-24ae3f02067d/go.mod h1:Ydcz7GN8uSpIoAI7h7+v89Q4peWaeq7jIAfsG0vfQKE= github.com/unifi-poller/webserver v0.0.0-20200626113232-24ae3f02067d/go.mod h1:Ydcz7GN8uSpIoAI7h7+v89Q4peWaeq7jIAfsG0vfQKE=
github.com/unifi-poller/webserver v0.0.0-20200627075529-02f6c576d7bc h1:O5qrJOu2E+WB5b5vSDDFrxW/Y7KBm+QdTRHc2Bad30Y= github.com/unifi-poller/webserver v0.0.0-20200627075529-02f6c576d7bc h1:O5qrJOu2E+WB5b5vSDDFrxW/Y7KBm+QdTRHc2Bad30Y=
@ -163,8 +169,13 @@ github.com/unifi-poller/webserver v0.0.0-20200628115531-e071827d7598 h1:Nmo1arOO
github.com/unifi-poller/webserver v0.0.0-20200628115531-e071827d7598/go.mod h1:rlM8tRx7wCxqj4+6ZkuFVt2voFoAlHhS/XTrHd7T57s= github.com/unifi-poller/webserver v0.0.0-20200628115531-e071827d7598/go.mod h1:rlM8tRx7wCxqj4+6ZkuFVt2voFoAlHhS/XTrHd7T57s=
github.com/unifi-poller/webserver v0.0.0-20200628212441-340749c94743 h1:B0K4P+dCLW5qG8hRhdMlrNEU+Yy0kAm9C2lCUmfBhPI= github.com/unifi-poller/webserver v0.0.0-20200628212441-340749c94743 h1:B0K4P+dCLW5qG8hRhdMlrNEU+Yy0kAm9C2lCUmfBhPI=
github.com/unifi-poller/webserver v0.0.0-20200628212441-340749c94743/go.mod h1:ekoFVYoCWwn2CjQVTC9PNF6OaXYzr7HSnfc1BDQxxjA= github.com/unifi-poller/webserver v0.0.0-20200628212441-340749c94743/go.mod h1:ekoFVYoCWwn2CjQVTC9PNF6OaXYzr7HSnfc1BDQxxjA=
github.com/unifi-poller/webserver v0.0.0-20200628214116-5bead091e113/go.mod h1:08IX30eb93+VbhiFqgMBXQD52+djPwivBcx5C8fH92M=
github.com/unifi-poller/webserver v0.0.0-20200628220857-bb444cf7da24 h1:1X1DPZdpjPamherE0mfcs+O+hl/M+stilDk5+88U9ak= github.com/unifi-poller/webserver v0.0.0-20200628220857-bb444cf7da24 h1:1X1DPZdpjPamherE0mfcs+O+hl/M+stilDk5+88U9ak=
github.com/unifi-poller/webserver v0.0.0-20200628220857-bb444cf7da24/go.mod h1:08IX30eb93+VbhiFqgMBXQD52+djPwivBcx5C8fH92M= github.com/unifi-poller/webserver v0.0.0-20200628220857-bb444cf7da24/go.mod h1:08IX30eb93+VbhiFqgMBXQD52+djPwivBcx5C8fH92M=
github.com/unifi-poller/webserver v0.0.0-20200629073701-8b95a5ac3e49 h1:8qVHNZg2Cf1dchBVCc8omU1ty56JQIQ9ZsyPg08EIs8=
github.com/unifi-poller/webserver v0.0.0-20200629073701-8b95a5ac3e49/go.mod h1:08IX30eb93+VbhiFqgMBXQD52+djPwivBcx5C8fH92M=
github.com/unifi-poller/webserver v0.0.0-20200630053536-1a5a6430daf4 h1:0II3Z/THLBBx8TCEYQkSlwn1KFLbGVe/OS/uNENvaS4=
github.com/unifi-poller/webserver v0.0.0-20200630053536-1a5a6430daf4/go.mod h1:08IX30eb93+VbhiFqgMBXQD52+djPwivBcx5C8fH92M=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=