fixes
This commit is contained in:
parent
06b36bf7d7
commit
d0b462523b
|
|
@ -9,7 +9,7 @@
|
||||||
"influx_pass": "unifi",
|
"influx_pass": "unifi",
|
||||||
"influx_db": "unifi",
|
"influx_db": "unifi",
|
||||||
"unifi_user": "influxdb",
|
"unifi_user": "influxdb",
|
||||||
"unifi_pass": "4BB9345C-2341-48D7-99F5-E01B583FF77F",
|
"unifi_pass": "",
|
||||||
"unifi_url": "https://127.0.0.1:8443",
|
"unifi_url": "https://127.0.0.1:8443",
|
||||||
"verify_ssl": false
|
"verify_ssl": false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,57 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
########################################################
|
||||||
|
# unifi-poller primary configuration file. XML FORMAT #
|
||||||
|
# provided values are defaults #
|
||||||
|
########################################################
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If the controller has more than one site, specify which sites to poll here.
|
||||||
|
If only one site, "default" is likely the correct name.
|
||||||
|
Set this to ["all"] to poll all sites, no matter their names.
|
||||||
|
Add more sites by adding additional lines:
|
||||||
|
<sites>site1</sites>
|
||||||
|
<sites>site2</sites>
|
||||||
|
-->
|
||||||
|
<sites>default</sites>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The Unifi Controller only updates traffic stats about every 30 seconds.
|
||||||
|
Setting this to something lower may lead to "zeros" in your data. You've been warned.
|
||||||
|
-->
|
||||||
|
<interval>30s</interval>
|
||||||
|
|
||||||
|
<!-- Turns on line numbers, microsecond logging, and a per-device log. -->
|
||||||
<debug>false</debug>
|
<debug>false</debug>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Turns off per-device log and per-interval log. Logs only errors.
|
||||||
|
Recommend using debug with this setting for better error logging.
|
||||||
|
-->
|
||||||
|
<quiet>false</quiet>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
# If the poller experiences an error from the Unifi Controller or from InfluxDB
|
||||||
|
# it will exit. If you do not want it to exit, change max_errors to -1. You can
|
||||||
|
# adjust the config to tolerate more errors by setting this to a higher value.
|
||||||
|
# Recommend setting this between 0 and 5. See man page for more explanation.
|
||||||
|
-->
|
||||||
|
<max_errors>0</max_errors>
|
||||||
|
|
||||||
|
<!-- InfluxDB does not require auth by default, so the user/password are probably unimportant. -->
|
||||||
<influx_db>unifi</influx_db>
|
<influx_db>unifi</influx_db>
|
||||||
<influx_pass>unifi</influx_pass>
|
<influx_pass>unifi</influx_pass>
|
||||||
<influx_url>http://127.0.0.1:8086</influx_url>
|
<influx_url>http://127.0.0.1:8086</influx_url>
|
||||||
<influx_user>unifi</influx_user>
|
<influx_user>unifi</influx_user>
|
||||||
<interval>30s</interval>
|
|
||||||
<max_errors>0</max_errors>
|
|
||||||
<quiet>false</quiet>
|
<!-- Make a read-only user in the Unifi Admin Settings. -->
|
||||||
<sites>default</sites>
|
|
||||||
<sites>site2</sites>
|
|
||||||
<unifi_pass>4BB9345C-2341-48D7-99F5-E01B583FF77F</unifi_pass>
|
|
||||||
<unifi_url>https://127.0.0.1:8443</unifi_url>
|
|
||||||
<unifi_user>influxdb</unifi_user>
|
<unifi_user>influxdb</unifi_user>
|
||||||
|
<unifi_pass></unifi_pass>
|
||||||
|
<unifi_url>https://127.0.0.1:8443</unifi_url>
|
||||||
|
<!--
|
||||||
|
If your Unifi controller has a valid SSL certificate, you can enable
|
||||||
|
this option to validate it. Otherwise, any SSL certificate is valid.
|
||||||
|
-->
|
||||||
<verify_ssl>false</verify_ssl>
|
<verify_ssl>false</verify_ssl>
|
||||||
|
|
|
||||||
|
|
@ -49,14 +49,14 @@ func (u *UnifiPoller) GetConfig() (err error) {
|
||||||
switch buf, err = ioutil.ReadFile(u.ConfigFile); {
|
switch buf, err = ioutil.ReadFile(u.ConfigFile); {
|
||||||
case err != nil:
|
case err != nil:
|
||||||
return err
|
return err
|
||||||
default:
|
|
||||||
err = toml.Unmarshal(buf, u.Config)
|
|
||||||
case strings.HasSuffix(u.ConfigFile, ".json"):
|
case strings.HasSuffix(u.ConfigFile, ".json"):
|
||||||
err = json.Unmarshal(buf, u.Config)
|
err = json.Unmarshal(buf, u.Config)
|
||||||
case strings.HasSuffix(u.ConfigFile, ".xml"):
|
case strings.HasSuffix(u.ConfigFile, ".xml"):
|
||||||
err = xml.Unmarshal(buf, u.Config)
|
err = xml.Unmarshal(buf, u.Config)
|
||||||
case strings.HasSuffix(u.ConfigFile, ".yaml"):
|
case strings.HasSuffix(u.ConfigFile, ".yaml"):
|
||||||
err = yaml.Unmarshal(buf, u.Config)
|
err = yaml.Unmarshal(buf, u.Config)
|
||||||
|
default:
|
||||||
|
err = toml.Unmarshal(buf, u.Config)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue