patricegautier / unifiZabbix

Zabbix templates to monitor pretty much all Unifi devices
179 stars 35 forks source link

Cannot Assign Template #23

Closed mighty-services closed 3 years ago

mighty-services commented 3 years ago

Dear nerds!

Thank you so much for this template, it will save me a ton of time - once I've got it running :) I'm new in the zabbix-world and got some things monitored already (like Linux servers and Windows Clients/Servers). Now I want to step into monitoring my Unifi equipment and found your amazing and UPDATED set of templates.

I followed your explanation. I've set up the two sh-skripts in the server, restarted the server, imported the most recent xml-template file and now want to add it to my previously auto-discovered USG/CloudKey. The error I got is this one:

on my USG when I add the USG template only image

and when I add the recommended SSH-Teplamte as well image

Linking only the ssh template works: image

But when I want to add the USG template after that, it gives me the same error: Two items ("Hostname" and "System name") cannot populate one host inventory field "Name", this would lead to a conflict.

I´m running Zabbix-server 5.4.5 and this is the host-overview of my usg: image

mighty-services commented 3 years ago

I have set no Macros yet and the same "problem" is seen when I want to add a template on the controller

patricegautier commented 3 years ago

Which release are you using? I think you might be using an old version.. I just stamped v1.2, might be a good time to update!

mighty-services commented 3 years ago

Dear Patrice,

I´m using your latest release. Just copied the sh-files and the xml-files out of your github-master branch yesterday.

Best regards

patricegautier commented 3 years ago

So I just created a test zabbix server and imported the latest version fresh, created a USG host and assigned both 'Unifi SSH Host' and 'Unifi USG' to it no problem. There is no conflict as far as I can see in the current version of those 2 templates.

I think what may be happening is that you have an old version of the template somehow on your zabbix server. Can you try deleting all the templates from this project and re-import the xml fresh?

mighty-services commented 3 years ago

Hy Patrice,

I thought the exact same thing, so I deleted the unifi templates and imported them fresh into zabbix. I didn´t restart or reload the cache - I don´t know if that is neccessary. Again the same error apperared.

Thanks for all your help!

Andy

mighty-services commented 3 years ago

So I just did it again - mark and delete all the unifi Templates: image

image

added the downloaded xml-file from today: image

image

image

image

and assigned them to the already existing unifi-host: image

then I also deleted the existing Host and recreated a new one: image

...worked!!! image

mighty-services commented 3 years ago

what's that now... i don't know :D

Do you think (because I had other Templates linked before), that there was some things still existing?

patricegautier commented 3 years ago

Ok let's take a look at the items in the unifi SSH host.. This is what I see:

image

Note there is no hostname or system name

patricegautier commented 3 years ago

And I bet there are old items left in the hosts you created prior..

mighty-services commented 3 years ago

probably :)

So I got further in your description and generated a keypair: image

opened the image

selected the text without the yellow one at the end

and copied the content into the Unifi-Webpage: image

image

image

and the key got accepted :)

mighty-services commented 3 years ago

but I just to stupid to try to ssh into it... :/

image with the zabbix-user it didn´t work and without it there´s no rout to host...

mighty-services commented 3 years ago

sorry, you wrote PRIVATE key, but that didn´t work either: image

mighty-services commented 3 years ago

I also tried it on my USG image

image

mighty-services commented 3 years ago

Sorry, I'm stumped...

patricegautier commented 3 years ago

ok a few things:

1- Identity file /root/.ssh/zabbix/zb id rsa not accessible: Permission denied.

you need to solve that one - the zabbix user on mighty-monitor need to have access to both the private key and public key

2- no route to host your zabbix server mighty monitor need to be able to get to any of the devices you are trying to monitor - can you ping them from there?

3- is the user name you are using to ssh into the USG and cloud key correct ?

mighty-services commented 3 years ago

Thanks a lot for your help!

So I tried some things and could manually establish a connection to my APs, Switches and USG. The controller somehow stayed locked. Even when I activated SSH login in the Web-Frontent:

I went further and applied the templated to my APs and switches. When I accessed the Server-Log there are many entries which look like this one:

`173216:20211023:200806.845 item "192.168.50.4:cpu" became not supported: Preprocessing failed for: Could not create directory '/var/lib/zabbix//.ssh'...{"anon_id":"13cdd8c9-889c-4331-8e06-8f88e454...

  1. Failed: cannot extract value from json by path "$.['system-stats'].cpu": cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: 'Could not create directory '/var/lib/zabbix//.ssh'. {"anon_id":"13cdd8c9-889c-4331-8e06-8f88e454b17e","architecture":"armv7l","board_rev":8,"bootid":1`

They all have the 'Could not create directory '/var/lib/zabbix//.ssh'. in common. I saw the same, when I tried to log into the devices manually from the server-terminal: image

The Test gave back the desired JSON, values (I guess at least): image

But the manual Test went through without asking for the password...at least for the administrator. The newly created user "zabbix" didn´t work

But I´ll check that later, for now I just want to initialize the monitoring. Everything else will happen after that.

When I look into the latest data and there are values for

the other values are empty. Is that normal?

mighty-services commented 3 years ago

So back to your suggestions:

the "file not accessible" was cleared, since I had it in the root directory and not in the home-dir of the zabbix-user.

The No route to host was solved since I stupidly put in the wrong IP-Address....it was late yesterday...

The user name was not existing yet, but even when I´ve created "zabbix" it wouldn´t let me in. When I use cat /etc/passwd it´s not in the displayed list of users. Neither in the USG nor in the controller

I used this guide: https://help.ui.com/hc/en-us/articles/1500011491541-UniFi-Manage-users-and-user-roles

patricegautier commented 3 years ago

So for the user on the devices, it’s whatever SSH user name you have specified in the Unifi controller when you activated SSH. It’s completely independent of what the users you are configuring in the link you mention.. It’s confusing I know. Will add this to the doc.

-P

On Oct 23, 2021, at 11:31 AM, mighty-services @.***> wrote:

So back to your suggestions:

the "file not accessible" was cleared, since I had it in the root directory and not in the home-dir of the zabbix-user.

The No route to host was solved since I stupidly put in the wrong IP-Address....it was late yesterday...

The user name was not existing yet, but even when I´ve created "zabbix" it wouldn´t let me in. When I use cat /etc/passwd it´s not in the displayed list of users. Neither in the USG nor in the controller

I used this guide: https://help.ui.com/hc/en-us/articles/1500011491541-UniFi-Manage-users-and-user-roles https://help.ui.com/hc/en-us/articles/1500011491541-UniFi-Manage-users-and-user-roles — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/patricegautier/unifiZabbix/issues/23#issuecomment-950193996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJFHTJ7SZMC5ZXRJ23NLGQTUIL5QVANCNFSM5GNN63MA.

patricegautier commented 3 years ago

Closing this one absent action..