Closed reginfo closed 6 years ago
Hello
It's not OK, of course. But it's so strange. 'version' key are "text" type data and it must be empty ("") on default if Miner can't fetch data from the Controller.
I think that there may be the following problems: 1) The Controller returns 0 in 'version' key (i don't know why); 2) You are specified null-char replacer as '0' inside .pl (and empty output replaced to '0'); 3) Zabbix 3.4 preprocessor changes empty string to '0' (i still use Zabbix 2.4 and did not install 3.4 branch);
When Miner returns empty output - it says that UniFi API's answer can't be loaded for parsing. This may be caused by network error, filesystem error (cache file can't written and then readed from /dev/shm because there is not room for files) or Controller restrictions, for example.
I changed Unsigned to Text, because of unsupported Item. I moved Miner on Unifi Management VM, look better, but from start I have received 0 values, after time normal values. I`m watching over.
I have added UAP template and my Proxy was DEAD handling ~10000 items.
How much UAPs you have?
I think that your problems also can be caused large number of requests to UniFi Miner, because it CLI utility and Zabbix create fork on every call. If no resources to create fork, UserParameter's behavior can be unpredicable.
You can disable some prototypes and re-attach template then or move to UniFi Proxy script.
193 WLAN 17 LAN
I`ve tryed from start without UAP template. Later added it. Now I unlink it and disable a lot of items. When Queue will be down I will attach it one more time!
Huge network. I think that better for this case is UniFi proxy + Zabbix loadable module on agent.
Maybe you are right, Raspberry Pi as Proxy is very week. Can you help me?
Management is on Ubuntu. There is no src folder. How to deal with it?
https://github.com/zbx-sadman/unifi_proxy/wiki/UniFi-Proxy-Guide-in-Russian -> "1. Загрузить исходные коды Zabbix и распаковать их";
https://www.zabbix.com/download -> Zabbix Sources -> ...
I had lost somewhere.
./configure Configuration: Detected OS: linux-gnu Install path: /usr/local Compilation arch: linux Compiler: gcc Compiler flags: -g -O2 Library-specific flags: Enable server: no Enable proxy: no Enable agent: no Enable Java gateway: no LDAP support: no IPv6 support: no
ls -lah /home/user/zabbix-3.4.5/src/modules/unifi/ total 28K drwxr-xr-x 2 root root 4.0K Jan 10 11:15 . drwxr-xr-x 4 1001 1001 4.0K Jan 10 11:13 .. -rw-r--r-- 1 root root 75 Jan 10 11:15 Makefile -rw-r--r-- 1 root root 13K Jan 10 11:15 unifi.c
zabbix-3.4.5/src/modules/unifi# make gcc -fPIC -shared -o unifi.so unifi.c -I ../../../include unifi.c: In function ‘unifi_proxy’: unifi.c:136:11: warning: null argument where non-null required (argument 2) [-Wnonnull] strcat(buffer, get_rparam(request, i)); ^
Where is a problem? Are my steps correct?
Yes, i see no error steps. I did test on 3.4.5 source just now:
# pwd
/home/sadman/zabbix-3.4.5/src/modules/unifi
# ls
total 8
drwxr-xr-x 2 root root 4096 Jan 10 13:33 .
drwxr-xr-x 4 zabbix zabbix 4096 Jan 10 13:26 ..
# wget https://raw.githubusercontent.com/zbx-sadman/unifi_proxy/master/src/modules/zbx_unifi_Zabbix_3_2/Makefile
--2018-01-10 13:28:42-- https://raw.githubusercontent.com/zbx-sadman/unifi_proxy/master/src/modules/zbx_unifi_Zabbix_3_2/Makefile
...
2018-01-10 13:28:43 (51.7 MB/s) - `Makefile' saved [75/75]
# wget https://raw.githubusercontent.com/zbx-sadman/unifi_proxy/master/src/modules/zbx_unifi_Zabbix_3_2/unifi.c
--2018-01-10 13:28:52-- https://raw.githubusercontent.com/zbx-sadman/unifi_proxy/master/src/modules/zbx_unifi_Zabbix_3_2/unifi.c
...
2018-01-10 13:28:53 (322 KB/s) - `unifi.c' saved [13282/13282]
# make
gcc -fPIC -shared -o unifi.so unifi.c -I ../../../include
# ls
total 36
-rw-r--r-- 1 root root 75 Jan 10 13:28 Makefile
-rw-r--r-- 1 root root 13282 Jan 10 13:28 unifi.c
-rwxr-xr-x 1 root root 12717 Jan 10 13:28 unifi.so
I will try to get clean VM and try from scratch.
:( Still the same error.
root@ZBX:/home/monitoring/zabbix-3.2.11/src/modules/unifi# make gcc -fPIC -shared -o unifi.so unifi.c -I ../../../include unifi.c: In function ‘unifi_proxy’: unifi.c:136:11: warning: null argument where non-null required (argument 2) [-Wnonnull] strcat(buffer, get_rparam(request, i)); ^ root@ZBX:/home/monitoring/zabbix-3.2.11/src/modules/unifi#
Ubuntu 16.04
Interesting.
Add/change bolded strings in unifi.c (unifi.zip):
static int unifi_proxy(AGENT_REQUEST request, AGENT_RESULT result) { .... unsigned int n, nbytes; char *param; ... for (i=0; i < np; i++) { param = get_rparam(request, i); strcat(buffer, param); ...
It's compiled under fresh Ubuntu 16.04 & Zabbix v.3.4.6, but i did not test it with agent.
I`ve changed unifi.c file, now without errors. But if the file created correctly?
nano unifi.so
^?ELF^B^A^A^@^@^@^@^@^@^@^@^@^C^@>^@^A^@^@^@P ^@^@^@^@^@^@@^@^@^@^@^@^@^@�/^@^@^@^@^@^@^@^@^@^@@^@8^@^G^@@^@^]^@^Z^@^A^@^@^@^E^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@�^X^@^@^@^@^@^@�^X^@^@^@^@^@^@^@^@ ^@^@^@^@^@^$ ^@^@^@^@^@^@^@o^@^@^@^Q^@^X^@^H" ^@^@^@^@^@^H^@^@^@^@^@^@^@�^A^@^@^P^@^X^@�! ^@^@^@^@^@^@^@^@^@^@^@^@^@�^A^@^@^R^@ ^@^@^L^@^@^@^@^@^@^@^@^@^@^@^@^@^@�^@^@^@^Q^@^X^@^P" ^@^@^@^$ ^@<^U^@^@^@^@^@^@^@^@^@^@^@^@^@^@�^A^@^@^R^@^L^@�^T^@^@^@^@^@^@H^@^@^@^@^@^@^@^@__gmon_start__^@_fini^@_ITM_deregisterTMCloneTable^@_ITM_registerTMCloneTable^@__cxa_finalize^@_Jv_R$ ^@^@^C^@^@^B^@^@^P^@^@^@u^Zi ^@^@^B^@ ^B^@^@^@^@^@^@�^] ^@^@^@^@^@^H^@^@^@^@^@^@^@ ^N^@^@^@^@^@^@�^] ^@^@^@^@^@^H^@^@^@^@^@^@^@� ^@^@^@^@^@^@� ^@^@^@^@^@^H^@^@^@^@^@^@^@� ^@^@^@^@^@� ^@^@^@^@^@^H^@^@^@^@^@^@^@H^U^@^@^@^@^@^@� ^@^@^@^@^@^H^@^@^@^@^@^@^@{^N^@^@^@^@^@^@^@! ^@^@^@^@^@^H^@^@^@^@^@^@^@T^U^@^@^$ ^@^@^@^@^@^@^@^@^@^@^@P ^@^@^@^@^@^G^@^@^@^K^@^@^@^@^@^@^@^@^@^@^@X ^@^@^@^@^@^G^@^@^@^L^@^@^@^@^@^@^@^@^@^@^@
^@^@^@^@^@^G^@^@^@
^@^@^@^@^@^@^@^@^@^@^@h ^@^@^@^@^@^G^@^@^@^O^@^@^@^@^@^@^@^@^@^@^@p ^@^@^@^@^@^G^@^@^@^P^@^@^@^@^@^@^@^@^@^@^@x ^@^@^@^@^@^G^@^@^@^R^@^@^@^@^@^@^@^@^@^@^@� ^@^@^@^@^@^G^@^@^@^S$
^@^@^@�@����%�^S ^@h^K^@^@^@�0����%�^S ^@h^L^@^@^@� ����%z^S ^@h
^@^@^@�^P����%r^S ^@h^N^@^@^@�^@����%j^S ^@h^O^@^@^@������%b^S ^@h^P^@^@^@������%�^R ^@f��%�^R ^@f�H�=9^T ^@H�^E9^T ^@UH)�H��H��^Nv^UH�^EN^R ^@H��t ]��f^O^D^@^@]�^O^@^@f.^O^_$
ƅ����^@��^@^@^@ƅ����^@Dž����^@^@^@^@��^@^@^@H�������@^H;�����~ H������H�@^P������Hc�H��^CH^A�H�^@�^E�^@^@^@^@H������H������H������H��H���1���H������H���������������������^A;�����~^G$
^@^@^@������H���^E������������^AH�Ƅ^E����^@������^A������;�����^O�<����^@^@^@^@�^A^@^@^@�^B^@^@^@������������������uZH�^UZ^P ^@H�57^E^@^@�^D^@^@^@�^@^@^@^@�^D���H�������@8�� ��H���$
^@H�^@H��H�^U�^N ^@H�5 ^D^@^@�^D^@^@^@�^@^@^@^@�q���H�������@8�� ��H�������P8H�=�^C^@^@�����H��H������H�P(�^A^@^@^@�^Y^A^@^@������H������������H�Ή������������������;�����tZH�^U<^N$
^@H�^PH�^Eb^L ^@�^@��u^O�^U:
^@H�^EO^L ^@�^P�]�UH��H��^P^H^@^@dH�^D%(^@^@^@H�E�1�H�^E�^K ^@H�^PH������L�^E�^L ^@H��H�^Uf^B^@^@�^@^H^@^@H�Ǹ^@^@^@^@�4���H������H��H�^U�^L ^@H�5D^B^@^@�^D^@^@^@�^@^@^@^@�M���H���$
^@H��������H�E�dH3^D%(^@^@^@t^E�^H�����UH��H�^UK^L ^@H�5^]^B^@^@�^D^@^@^@�^@^@^@^@������^@^@^@^@�)����^@^@^@^@�����H�^Eb^K ^@�^PH�^E9^K ^@H�^@A��H��H�^U^A^L ^@H�5�^A^@^@�^D^@^@^@�$
^@%s/%s^@^@^@%s: load & parse config stage. Config file is %s^@%s: init module stage^@^@%s: UniFi Proxy host is '%s:%d'^@%s: Un-init module stage^@UniFiProxyServer^@UniFiProxyPort^$
^FF^L^G^H^@^@^@^\^@^@^@d^@^@^@����^S^@^@^@^@A^N^P�^BC
^FN^L^G^H^@^@^@^\^@^@^@�^@^@^@����
^@^@^@^@A^N^P�^BC
^FH^L^G^H^@^@^@^\^@^@^@�^@^@^@s���2^@^@^@^@A^N^P�^BC
^Fm^L^G^H^@^@^@^\^@^@^@�^@^@^@�����^D^@^@^@A^N^P�^BC
^F^C�^D^L^G^H^@^\^@^@^@�^@^@^@#���C^@^@^@^@A^N^P�^BC
^F~^L^G^H^@^@^@^\^@^@^@^D^A^@^@F����^@^@^@^@A^N^P�^BC
^F^B�^L^G^H^@^@^\^@^@^@$^A^@^@����r^@^@^@^@A^N^P�^BC
^F^Bm^L^G^H^@^@^\^@^@^@D^A^@^@$���(^@^@^@^@A^N^P�^BC
^Fc^L^G^H^@^@^@^\^@^@^@d^A^@^@,���H^@^@^@^@A^N^P�^BC
`
I'm not linux kernel and can't read binary data directly.
Just load this module it with zabbix agentd and test with -t key.
Sorry for long delay, was working on one project.
So I still haven`t got it work.
So I compiled unifi.so. I install zabbix-agent (from packages) on this system. Created new folder /usr/local/lib/zabbix/ Move there unifi.so file Changed permission chown zabbix:zabbix unifi.so and chmod 644 unifi.so Changed zabbix_agentd.conf file with : LoadModulePath=/usr/local/lib/zabbix LoadModule=unifi.so Also added unifi.conf file to /usr/local/lib/zabbix
root@unifi-server:/usr/local/lib/zabbix# ls /usr/local/lib/zabbix unifi.conf unifi.so
restarted zabbix agent. From log file see that unifi.so is loaded.
9515:20180226:145727.339 using configuration file: /etc/zabbix/zabbix_agentd.conf 9515:20180226:145727.339 loaded modules: unifi.so
Bet when I try to execute
zabbix_agentd -t "unifi.proxy[discovery,wlan]"
I receive
unifi.proxy[discovery,wlan] [m|ZBX_NOTSUPPORTED] [Error: connect failed]
All files are on unifi_server management machine!
Take look in the source:
...
if (connect(sockfd, (struct sockaddr*) &server_addr , sizeof(server_addr)) < 0)
{
zabbix_log(LOG_LEVEL_DEBUG, "%s: connect to '%s' failed", ZBX_MODULE_NAME, UNIFI_PROXY_SERVER);
SET_MSG_RESULT(result, strdup("Error: connect failed"));
return SYSINFO_RET_FAIL;
}
...
Unfortunately i can't debug case like that if i have no access to problem system.
We can try to arrange some remote connection.
Yes, we can, if you want to buy out my work time.
My email address is placed on profile frontpage.
And what is the price for this work?
It not software related question, please contact to me via email if you need answer.
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.
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](https://user-images.githubusercontent.com/4628571/34599521-77bb862e-f1fb-11e7-9c14-747aee3bd726.PNG)
Is this OK?
Zabbix 3.4.4