unpoller / unpoller

Application: Collect ALL UniFi Controller, Site, Device & Client Data - Export to InfluxDB or Prometheus
https://unpoller.com
MIT License
2.06k stars 146 forks source link

unpoller.conf path for Docker #364

Closed McMacaron closed 1 year ago

McMacaron commented 3 years ago

Hello David,

I have spent more than 20hours installing unpoller to Ubuntu 21.04 64bit. It seems that everything is working but Unpollen can not pick up settings from unpoller.conf file. Instead of that it is taking some default config file with URL https://127.0.0.1:8443: unifi controller. I have UDM Pro...

I have even try to set path with docker run -v /home/ubuntu/Docker/unpoller:/config/unpoller.conf golift/unifi-poller

Absolutely nothing works.

It tried permissions to folders. Set config to different etc locations....

Last part of Yaml: unpoller: container_name: Unpoller01 restart: unless-stopped image: golift/unifi-poller:latest depends_on:

unpollen.conf:

UniFi Poller v2 primary configuration file. TOML FORMAT

###########################################################

[poller]

debug = true

quiet = false

plugins = []

OUTPUTS

[prometheus] disable = true

http_listen = "1.0.0.0:9130"

ssl_cert_path = "" ssl_key_path = ""

report_errors = false

dead_ports = false

[influxdb] disable = false

url = "http://192.168.88.138:8086" user = "unifipoller"

pass = "xxx"

db = "unifi"

verify_ssl = false

interval = "30s"

dead_ports = false

[loki] url = ""

user = "" pass = "" verify_ssl = false tenant_id = "" interval = "2m" timeout = "10s"

[webserver] enable = false port = 37288

html_path = "/usr/lib/unifi-poller/web" ssl_cert_path = "" ssl_key_path = ""

max_events = 200

[webserver.accounts]

INPUTS

[unifi]

dynamic = false

[unifi.defaults]

url = "https://192.168.88.1"

user = "unifipoller"

pass = "ssssss"

sites = ["all"]

save_sites = true

hash_pii = false

save_ids = true

save_events = true

save_alarms = false

save_anomalies = true

save_dpi = true

save_rogue = true

verify_ssl = false

ssl_cert_paths = []

davidnewhall commented 3 years ago

Rename it to unifi-poller.conf. The documentation is currently ahead of the app. It was hastily renamed.

McMacaron commented 3 years ago

Uff Uff. Thanks that works instantly. I thought I will give up. It is running nicely on Raspberry Pi 4, ubuntu server 21.04 64bit. I had a problem with Raspbian 32bit as Influx ran one of the raspberry core on 100% and the second was jumping up and down from 40%-100%. Now one core is running on 5%. Even the swap file is empty now and it is using just 470Mb of memory So it is perfectly suitable for unpoller. I will make an easy install tutorial for it.

Videothek commented 3 years ago

Hello,

i have the same problem.

I edited like 20 different versions of the .conf file.

I am using this config file: https://github.com/unpoller/unpoller/blob/master/examples/up.conf.example

I changed all the variables.

When I run unpoller with this docker command:

$sudo docker run -v /your-local-location/unpoller.conf:/config/unpoller.conf golift/unifi-poller

I get this output:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 2021/07/19 20:13:01 [INFO] Loading Configuration File: /etc/unifi-poller/up.conf 2021/07/19 20:13:01 [INFO] UniFi Poller v2.1.3 Starting Up! PID: 1 2021/07/19 20:13:01 [ERROR] Controller 1 of 1 Auth or Connection Error, retrying: unifi controller: making request: Get "https://127.0.0.1:8443/": dial tcp 127.0.0.1:8443: connect: connection refused 2021/07/19 20:13:01 [INFO] Poller->InfluxDB started, interval: 30s, dp: false, db: unifi, url: http://127.0.0.1:8086 2021/07/19 20:13:01 [INFO] Internal web server disabled! 2021/07/19 20:13:01 [INFO] Loki config missing (or disabled), Loki output disabled! 2021/07/19 20:13:01 [INFO] Prometheus exported at http://0.0.0.0:9130/ - namespace: unifipoller

It is really weird that he uses my defined database but not the new ip addresses that i defined.

Does anyone have a clue what this could be?

Thanks in Advance :-).

davidnewhall commented 3 years ago

Same solution: rename your config.

Videothek commented 3 years ago

Same solution: rename your config.

Actually i tried it and it doesnt work with the same output.

Videothek commented 3 years ago

Does the location of the config file matter?

davidnewhall commented 3 years ago

The location matters. It can be in one of two locations, both defined on this line of code: https://github.com/unpoller/poller/blob/master/build_unix.go#L6

The default/empty config exists in the container at /etc/unifi-poller/up.conf. You can either overwrite that one, or put it in /config at /config/unifi-poller.conf.

Videothek commented 3 years ago

The location matters. It can be in one of two locations, both defined on this line of code: https://github.com/unpoller/poller/blob/master/build_unix.go#L6

The default/empty config exists in the container at /etc/unifi-poller/up.conf. You can either overwrite that one, or put it in /config at /config/unifi-poller.conf.

Hello,

thanks for the fast reply.

I tried to put the config file in /etc/unifi-poller/up.conf as well as /etc/unifi-poller/unifi-poller.conf

My command to run looked than like that: sudo docker run -v /etc/unifi-poller/unifi-poller.conf:/config/unifi-poller.conf golift/unifi-poller

Now i get more error messages like this: cnfg unmarshal: unmarshaling file [/config/unifi-poller.conf]: Near line 39 (last key parsed 'poller.Password'): expected key separator '=', but got 'f' instead

Any Ideas?

Thank You in Advance.

davidnewhall commented 3 years ago

That means the config file format is bad, or you're passing something that is not a poller config file. Can you share the file? Also, try this:

sudo docker run -v /etc/unifi-poller:/config golift/unifi-poller
Videothek commented 3 years ago

That means the config file format is bad, or you're passing something that is not a poller config file. Can you share the file? Also, try this:


sudo docker run -v /etc/unifi-poller:/config golift/unifi-poller

Hmm weird,

this is my config file: https://github.com/unpoller/unpoller/blob/master/examples/up.conf.example

I will try the other command later.

Thank You for your help.

davidnewhall commented 3 years ago

That's not your config file. That's like taking a brand new Toyota to the service center when your old Toyota is at home broken.

Videothek commented 3 years ago

That's not your config file.

This is the example config, i dont want to share my passwords.

Everything in this file is the same except the variables like IPs and Passwords.

davidnewhall commented 3 years ago

Good luck.

Videothek commented 3 years ago

Good luck.

Well the command sudo docker run -v /etc/unifi-poller:/config golift/unifi-poller doesnt work.

Why do you need my exact config file?

Everything is identical except the variables.

davidnewhall commented 3 years ago

I don't. I suspect the error message telling you line 39 is malformed should be enough for you to troubleshoot and fix the problem.

Videothek commented 3 years ago

I don't. I suspect the error message telling you line 39 is malformed should be enough for you to troubleshoot and fix the problem.

I have tried to uncomment the line after that i get the next error on another line and so on.

So I dont think i cant fix it on my own.

I would if i think i could do anything but i ran out of ideas.

davidnewhall commented 3 years ago

Try using env variables instead of a config file.

Videothek commented 3 years ago

Try using env variables instead of a config file.

Ok thx i will try it later.

Videothek commented 3 years ago

Try using env variables instead of a config file.

Hello now i can test the variables.

Could you show me an example on how to write those variables?

Thx :-)

davidnewhall commented 3 years ago
docker run -e UP_UNIFI_DEFAULT_URL=http://localhost:8443 -e UP_UNIFI_DEFAULT_PASS=superSecret123 golift/unifi-poller

The two variables shown here are the bare minimum, but you probably need to also pass UP_INFLUXDB_URL if you're using InfluxDB. All variables are documented here: https://unpoller.com/docs/install/configuration

Videothek commented 3 years ago
docker run -e UP_UNIFI_DEFAULT_URL=http://localhost:8443 -e UP_UNIFI_DEFAULT_PASS=superSecret123 golift/unifi-poller

The two variables shown here are the bare minimum, but you probably need to also pass UP_INFLUXDB_URL if you're using InfluxDB. All variables are documented here: https://unpoller.com/docs/install/configuration

Hello,

thanks but i tried with the config file a little bit more.

I got it to work now.

I shranked down my config file to this:

[unifi.defaults]
  url  = "https://controller_url:8443"
  user = "read_only_user"
  pass = "read_only_user_password"
  save_dpi = true
[influxdb]
  url  = "http://influxdb_url:8086"
  db = "database_name"
  user = "influxdb_user"
  pass = "influxdb_password"

And placed it in /etc/unifi-poller/unifi-poller.conf

Than I start the unpoller with: sudo docker run -v /etc/unifi-poller:/config golift/unifi-poller

Thank You for your help and sorry for wasting your time.

Hope it helps someone else too.

:-)

877dev commented 3 years ago

Rename it to unifi-poller.conf. The documentation is currently ahead of the app. It was hastily renamed.

That worked for me using Docker Compose as well, thanks!

PS noticed an extra 1 in the URL on the install/grafana page under "Configure Datasource" bullet point 3: Set the following fields: Name = UniFi InfluxDB (or whatever name you want) and set to default URL = http://influxdb1:80 Database = unifi Username = unifipoller Password = unifipoller

Also I did not set influxdb password so did not need the username/password... Thanks

davidnewhall commented 2 years ago

@beezub99 Submit a PR with the disclaimer. Happy to include it.

beezub99 commented 2 years ago

i deleted my comment because it was harsh. but i would be happy to take note of the documentation errors i found and send them over if that helps.

davidnewhall commented 2 years ago

I've had very little give a fucks about this project since Ubiquiti hit me with a cease and desist. One day I'll care enough to update the readme to that affect. PRs welcome.

beezub99 commented 2 years ago

thats fair enough, i didn't realize they had done that. definately in line with how they operate. i apologies for the post, I think i was taking my frustration of them out on you.

davidnewhall commented 2 years ago

Sorry it's been frustrating. Not many people 'know'. I just slipped away. If you join discord I'm happy to provide assistance there.

platinummonkey commented 1 year ago

updated this in 2.4.x

https://github.com/unpoller/unpoller/blob/master/pkg/poller/config.go#L39

/etc/unpoller/up.conf

docs will get updated soon-ish