MassimilianoPasquini97 / zbx_unifi_network

Zabbix Template for Unifi Network
MIT License
61 stars 10 forks source link

Troubles Poll/Connecting to VM Controller #10

Closed athornfam2 closed 12 months ago

athornfam2 commented 1 year ago

Are these the correct settings for the Macros? image

FreakyBigFoot commented 1 year ago

Hey perfect timing. I too am having trouble. I get a warning that says "could not resolve host https" and that's all I see. I also added the same exact variables.

MassimilianoPasquini97 commented 1 year ago

@athornfam2 You can at least mention what tipe of error (if there is one) you are facing?

MassimilianoPasquini97 commented 1 year ago

@FreakyBigFoot are you using full url on {$UNIFI.IP} macros instead of ip or fqdn?

FreakyBigFoot commented 1 year ago

I just got it to work. I used my fqdn. Don't put http:// or https:// just the FQDN or IP. I'm seeing a bunch of data now. I'm not sure if you have to but I enabled the Discovery in Data Collection > Hosts > Unifi Network (or whatever yours is named) Then I selected Discovery and enabled all 5. Hopefully this helps with you.

MassimilianoPasquini97 commented 1 year ago

All instructions on how to use this template is well documented on main README.md file, from 'How to use' section:

{$UNIFI.IP}: IP or FQDN of Unifi Network Web Interface.

athornfam2 commented 1 year ago

Can't get it polling with all the instructions follow.

Confirmed connectivity to the VM (Zabbix is on the same subnet) The https portal is working from another VM Macros are configured as shown Host is setup with the IP address No interface is setup Discovery triggers are enabled Confirmed View only account is working (added stats and site access later but is now viewable by this account)

Temerev-KS commented 12 months ago

Currently facing what seems to be the same or similar problem. I'm using latest available version (8.0.7) of Controller (Network App) installed on the Ubuntu Server VM, that is hosted on the same hardware as Zabbix VM. Outside of this issue both Controller and Zabbix are working fine and I can ping both vms from either one of them. In Zabbix wen I go to the host settings of the added Unifi Network host next to discovery rules I see red exclamation marks with popup messages stating "Cannot perform request: Could not resolve host: api". What I have noticed is that self hosted controller uses port 8443 instead of 443. I experimented by including port number in {$UNIFI.IP} macros, but that didn't help.

MassimilianoPasquini97 commented 12 months ago

Hi @Temerev-KS, this template was tested only using https port 443, http isn't supported. You can provide me the error returned from this 3 items?

image
Temerev-KS commented 12 months ago

this template was tested only using https port 443, http isn't supported. You can provide me the error returned from this 3 items?

Hi! Thank you for replying quickly! Now I'm afraid that I can't provide you the error, because now everything is working fine! But yesterday it was literally "Cannot perform request: Could not resolve host: api". It's one of those times when you change absolutely nothing and try to run/refresh it first thing in the morning and it just works. Not sure if this is bad because it indicates some instability or good because everything seems fine right now.

Regarding what you've mentioned, about http vs https. Evidently controller app uses https, but just running api and webgui on a different port (my guess is to avoid compatibility issues and uncertainties associated with self hosting). There is a port reference page on the Ubiquiti website were they state the difference in ports used by their hardware controllers (like UDMs, Cloud Keys, etc.) and self hosted applications.

Now I should mention that currently in {$UNIFI.IP} macros I have ip address with port specified.

Screenshot 2023-11-26 at 12 28 12

Perhaps this is something worth mentioning in the readme.md.

Anyway, I appreciate your work, thank you!

MassimilianoPasquini97 commented 12 months ago

This error Cannot perform request: Could not resolve host: api can be caused by an incorrect configuration of one of this MACROS: {$UNIFI.API.AUTH.TOKEN}, {$UNIFI.API.AUTH.URI}, {$UNIFI.API.URI} and {$UNIFI.IP}. This MACROS need to be configured following README.md otherwise the template doesn't work.

Port can be used on {$UNIFI.IP} but I never tested it. This is how is used on template, so port can be specified.

image
athornfam2 commented 12 months ago

@MassimilianoPasquini97 I'm not receiving any error at all for my host with the correct configuration in place.

MassimilianoPasquini97 commented 12 months ago

@athornfam2 I need the error reported from the items mention on my previous message otherwise I can't help you.