Code Monkey home page Code Monkey logo

unifi_miner's Introduction

UniFi Miner

Experimental release is v1.4.0. Unifi Controller v7, Zabbix v6 (and JSONPath) supported. Try Miner and compatible template now.

Actual release is v1.3.8. You can download its here.

See change log before update.

Fastest client-server version of UniFi Miner is UniFi Proxy.

It is a small tool written in Perl, which helps deliver to the monitoring system (Zabbix) operational data - metrics and settings obtained from the UniFi controller via API, provided by Ubiquiti. Zabbix's Low-level Discovery (LLD) protocol are supported.

Zabbix: connected clients

If you have a question about Miner, please, read Russian or English guide.

If u have an problem, you can search the existing closed or open issues.

Templates for Zabbix here. Note, that since v1.3 released, UniFi proxy templates must be used.

All new experimental features can be found here

donation

My other projects

UniFi Proxy - client-server version of UniFi Miner

Zabbuino - Zabbix agent for Arduino

unifi_miner's People

Contributors

zbx-sadman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unifi_miner's Issues

Import Template UBNT_UNIFI_Controller Zabbix 3.2

Hi guys! I was following Sadman's instructions to install the miner and reading the issue with Windows Controllers. That said, I manage to make it work, but can't import the template on Zabbix (3.2.6). First I needed to change the max_upload_size on Zabbix, but now Iam getting this error:

"Cannot read XML: (41) Specification mandate value for attribute data-pjax-transient [Line: 35 | Column: 40]."

I'm not a programmer but I guess it has to do with Zabbix validations on XML file.

Can someone help?

Best Regards,
Luiz

malformed JSON string

Hi!

When send this command:

root@zabbix:~/unifi_miner# ./unifi_miner.pl -a discovery -o uap -s bcg2fhu9 -l http://172.16.44.12:8443 -u admin -p pass00 -c 0

I will return this string:

malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "\x{15}\x{3}\x{3}\x{0}...") at ./unifi_miner.pl line 892.

Any idea? =)

Thanks!!

Special characters in zabbix keys are not supported

I have installed both the perl script and the zabbix templates.
Unfortunately they do not work.
The autodiscovery is generating keys like:

unifi.proxy[get,network,kvraj6sw,"[_id=58bb88aee4b0e875087b023d].purpose"]

which are not supported by Zabbix because you cannot include " and especially [ and ] in key.

License

Hi! Under what license Unifi Miner is published?

If possible, please add a LICENSE file.

Setup with Zabbix 3 and Ubuntu 14.04 server

Hi all,

I am trying to setup the uifi miner with zabbix 3. I am currently following the steps here https://www.zabbix.com/forum/showthread.php?t=44717&page=2

I have:

  1. copied unifi_miner.pl to /usr/lib/zabbix/externalscripts/. And it is working with some input commands.
  2. copped unifi.conf that i found here to /etc/zabbix/zabbix_agentd.d/ .
  3. I have Include=/etc/zabbix/zabbix_agentd.d/ in /etc/zabbix/zabbix_agentd.d/
  4. Changed UserParameter in /etc/zabbix/zabbix_agentd.d/unifi.conf to include /usr/lib/zabbix/externalscripts/unifi_miner.pl

Just a question before i continue. Should i be using unifi.conf or unifi_proxy.conf? Can i use Miner with unifi_proxy.conf? I can't see that mentioned in the miner guide

Fail in line 861

Hi, i have Unifi version 5.6.22.
Your script works great, but when i get for example firmware version of AP, i get three lines of
Use of uninitialized value in string eq at /etc/zabbix/scripts/unifi_miner.pl line 861.
and then is firmware version numbers.
I'm not a python programmer, that mean, i don't know, what line 861 does.
For this moment i fix this issue by delete
, last if (@{$jsonData}[$i]->{$idKey} eq $_[3]);
from line 861.
But i think, that isn't right solution:-)
Please, can you help me?
Thanks

zabbix template

Template zbx_v2_4_Template_UBNT_UniFi_Controller_Miner_edition_v_4 при добавление в zabbix Zabbix 2.4.7 выкидывает
XML file contains fatal error 41:Specification mandate value for attribute data-pjax-transient [ Line: 34 | Column: 40 ]

Подскажите как исправить?

No error messages when LWP::Protocol::https is not installed

It took me a while before I got it working and hopefully you will modify your code so others don't have the same problem.
The reason why it didn't work out of the box for me is probably because I started with a fresh perl installation from source.
On this server there's also other software and it has perl pre-installed.
I installed a fresh perl in /usr/local/bin

I modified /usr/local/sbin/unifi_miner.pl so it has the credentials in the code and also modified the first line to

#!/usr/local/bin/perl

I then executed unifi_miner.pl and I saw I needed to install some perl modules which I did with CPAN until I didn't get any errors.
I then started unifi_miner.pl again and it just gave me this

unifi_miner.pl

{
   "data" : []
}

It wasn't until I enabled DEBUG until I found what was going on.....

unifi_miner.pl 
[18046] 2021-02-18 22:52:59 [+] fetchData() started
[18046] 2021-02-18 22:52:59 [+] fetchDataFromController() started
[18046] 2021-02-18 22:52:59 [>]  args: object path: 'https://127.0.0.1:8443/api/self/sites'
[18046] 2021-02-18 22:52:59 [!] Comminication error: '501 Protocol scheme 'https' is not supported (LWP::Protocol::https not installed)'

[18046] 2021-02-18 22:52:59 [!] Can't fetch data from controller
[18046] 2021-02-18 22:52:59 [*] Logout from UniFi controller
{
   "data" : []
}

That was easy to fix, but it took a long time before I enabled debug.

Can you please change the code accordingly so this kind of error gets any feedback. The code could also test for LWP::Protocol::https

A lot of Queue for Zabbix active

Hi,

we using your solution a long time, now we builded new environment with DB cluster, proxysql and two zabbix servers with pacemaker and corosync. Together with the environment upgrade I did upgrade zabbix to version 4.4.1 and on the new environment I have problem with a lot of Queue for Active checks. I tryed change zabbix agent and zabbix server settings like buffer, pollers etc. and nothing helped me. Could you please make update of this template or do you have any advice for me or someone? Thanks a lot.

PS: on old environment was zabbix on 4.2.x version and all worked fine.

Still show data of deleted UAPs

Hi, I Have a v5 Unifi controller with 4 UAPs conected. unifi_miner give me the correct answer when I search the amount of active UAPs ( ./unifi_miner.pl -a count -o uap -k "[state=1].state") and/or (./unifi_miner.pl -a sum -o uap -s default -k adopted).

But after I delete one UAP from the controller the discovery option still show me 4 UAPs connected to the controller. And show me the erased UAP at state=0 as it's disconected...

To compare this result I use https://github.com/malle-pietje/UniFi-API-browser and it show me the correct values.. (3 managed UAPs and 0 Disconected)

Thanks!

Странная работа фильтров

Делаю
unifi_miner.pl -a get -o user -k [rssi=28].ip -c 1
результат
192.168.1.112

делаю
unifi_miner.pl -a get -o user -k [rssi>27].ip -c 1
В выводе пусто.

Вообще знак больше и меньше у меня не работает. Равно и не равно выводит значения.

Unifi miner moving in and out of unsupported state

In the zabbix log at /var/log/zabbix/zabbix_server.log

The unifi.proxy is moving to unsupported and then supported again. I can see this in the log file...

  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=04:18:d6:20:93:21].[rssi>10&rssi<=15].rssi",,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=04:18:d6:80:c8:57].[rssi>15&rssi<=25].rssi",,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=04:18:d6:20:93:21].[rssi>15&rssi<=25].rssi",,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=04:18:d6:80:c8:57].[rssi>25&rssi<=40].rssi",,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=04:18:d6:20:93:21].[rssi>25&rssi<=40].rssi",,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=04:18:d6:80:c8:57].[rssi>40].rssi",,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=04:18:d6:20:93:21].[rssi>40].rssi",,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[sum,uap,default,"vap_table.rx_errors",57444e382ed0e7778ae1bd72,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[sum,uap,default,"vap_table.tx_errors",5404a444d0f9054c70518ec8,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[sum,uap,default,"vap_table.tx_errors",5404a444d0f9054c70518ec6,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[sum,uap,default,"vap_table.tx_errors",5404a444d0f9054c70518eca,0]" became not supported: Unsupported item key.
  1542:20160916:134826.498 item "127.0.0.1:unifi.proxy[sum,uap,default,"vap_table.tx_errors",54a2d0c6d0f983b6dee0443f,0]" became not supported: Unsupported item key.
  1544:20160916:134853.130 item "127.0.0.1:unifi.proxy[sum,uap,default,state,,0]" became supported
  1542:20160916:134857.563 item "127.0.0.1:unifi.proxy[sum,uap,default,"stat.tx_dropped",,0]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[sum,uap,default,"vap_table.rx_errors",,0]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[sum,uap,default,adopted]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[sum,uap,default,guest-num_sta]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[sum,uap,default,isolated]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[sum,uap,default,locating]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[sum,uap,default,num_sta,,0]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[sum,uap,default,rx_bytes,,0]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=24:a4:3c:02:e4:c3].[rssi<10].rssi",,0]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=24:a4:3c:02:e4:80].[rssi<10].rssi",,0]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=24:a4:3c:b0:4c:b0].[rssi<10].rssi",,0]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=24:a4:3c:02:e4:c3].[rssi<20].rssi",,0]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=24:a4:3c:02:e4:80].[rssi<20].rssi",,0]" became supported
  1542:20160916:134857.564 item "127.0.0.1:unifi.proxy[pcount,user,default,"[ap_mac=24:a4:3c:b0:4c:b0].[rssi<20].rssi",,0]" became supported

And i do have UnsafeUserParameters=1 enabled.

root@zabbix:~# less /etc/zabbix/zabbix_agentd.conf | grep UnsafeUserParameters
### Option: UnsafeUserParameters
UnsafeUserParameters=1

Have you seen this before?

Unifi_Miner with Zabbix 5.2 version

Hello team,

I want to thank for the good job you have done regarding unifi miner. I have installed it on Unifi Controller on Debian 11 and it is working as I have data from unifi controller using ./unifi_miner.pl and zabbix-get messages. My problem is that I can't have data on zabbix. I have imported the Unifi Controller v5 passive chechks template, but I have no data. This template is used foe zabbix 2.4 version, how can we modify it working for version 5.2 ? Do you have done integrations of unifi miner using zabbix 5.2 ? Anything will be very helpful for me.

Regards

Some data but not all

Hi Sadman! I'm trying to solve this mistery for a couple days now. Iam using Zabbix 3.2.6 with a Windows UBNT Controller and following your instructions I was happy to tell that it worked, the LLD created itens, triggers and graphs for every AP that I have, but, the only itens Iam receiving data on Zabbix is the ICMP, Clients connected and Users Connected.

Shouldn't I receive all data at this point? And since no data is comming from a lot of itens, the queue grows and the cache runs low.

Could u help me once again?

Best regards,
Luiz

Full Support for Unifi Controller v6

Hi,

The version 6 of unifi controller is now available, we ave updated some of our controller to it but I don't if it's that but those VMs have a huge CPU utilization when executing the script. We still have metrics that works BTW so the API doesn't seems to have change a lot.
When do you think you will update for support of version 6 ?

Thanks for the reply and great work !

Last Value sometimes is 0

Hi,

I am set up script on Raspberry Pi as Zabbix Proxy.
If I`m running from console, everything fine.

zabbix_agentd -t unifi.proxy[get,sysinfo,default,version]
unifi.proxy[get,sysinfo,default,version] [t|5.5.20]

I imported Template UBNT UniFi Controller v5 - passive checks.
But last value sometimes is 0.
values
P.S. I`m reduce update interval for testing purposes.

zabbix_agentd -t unifi.proxy[get,sysinfo,default,autobackup]
unifi.proxy[get,sysinfo,default,autobackup] [t|false]

I receive 0, not False.
values 2

Is this OK?

Zabbix 3.4.4

Number of users per WLAN

Hello,

I would like to get the amount of users logged into a UAP over WLAN.

Is there any way to get this information?

Thank you!

Use of uninitialized value in string at /usr/bin/unifi_miner.pl line 1070

Привет! есть проблема с запуском скрипта.
версия контроллера 5.11

данные по
unifi.proxy[discovery,uap] заббикс получает нормально

zabbix_agentd -t unifi.proxy[discovery,uap,,vap_table]
unifi.proxy[discovery,uap,,vap_table] [t|Use of uninitialized value in string at /usr/bin/unifi_miner.pl line 1070.

zabbix_agentd -t unifi.proxy[discovery,uap,,vwire_vap_table]
unifi.proxy[discovery,uap,,vwire_vap_table] [t|Use of uninitialized value in string at /usr/bin/unifi_miner.pl line 1057

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.