pthoelken / fritzbox-zabbix-monitoring

Zabbix Monitoring for AVM FritzBox devices
8 stars 2 forks source link

Hostname Required, Sending failed #18

Open geiasounai opened 1 month ago

geiasounai commented 1 month ago

Hello,

Using the following send command: zabbix_sender -z -i - -p 10050 -vv monitor_1 | zabbix_sender [8]: ERROR: [line 6] 'Hostname' required monitor_1 | Sending failed.

Hostname correctly defined in docker_compose.yaml file, without " characters.

pthoelken commented 1 month ago

Thanks for your report. This issue is under investigation. Can you provide me a screenshot from your zabbix fritzbox host configuration window and paste your docker-compose.yml (without sensitive data) in here? Which Zabbix Server Version is in use?

Thanks.

pthoelken commented 1 month ago

Please try this image: pthoelken/fritzbox-zabbix-monitoring:dev-18

geiasounai commented 1 month ago

Hello!

image

YAML file:

version: '3.2' services: monitor: image: pthoelken/fritzbox-zabbix-monitoring:dev-18 restart: always environment:

Tried with and without " characters at FRITZBOX_HOSTNAME field.

pthoelken commented 1 month ago

Hello!

image

YAML file:

version: '3.2' services: monitor: image: pthoelken/fritzbox-zabbix-monitoring:dev-18 restart: always environment: - ZABBIX_SERVER=10.10.1.111 - ZABBIX_SERVER_PORT=10050 - INTERVAL=30s - FRITZBOX_HOSTNAME=ISP Router - FRITZBOX_IP=192.168.1.1 - FRITZBOX_USER=** - FRITZBOX_PASSWD=*** - ZABBIX_SENDER_DEBUG=True

Tried with and without " characters at FRITZBOX_HOSTNAME field.

Always it's a bad idea to use spaces in hostnames. Please remove the spaces in the hostname and try it again.

Which base os did you use?

pthoelken commented 1 month ago

@geiasounai can you paste your output from this command docker exec -it fritzmon_fritzbox-zabbix-monitoring_1 printenv here (maybe you have to change the container name)? Remove sensitive data like passwords before pasting. Thanks.

geiasounai commented 1 month ago

@pthoelken , i tried without space in the hostname, with and without " characters but it still fails. Please check below ouput from command requested:

root@fritzbox-zabbix-monitoring:~# docker exec -it root_monitor_1 printenv PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOSTNAME=0f3f6bdeb943 TERM=xterm ZABBIX_SERVER=10.10.1.111 ZABBIX_SERVER_PORT=10050 INTERVAL=30s FRITZBOX_HOSTNAME=isprouter FRITZBOX_IP=192.168.1.1 FRITZBOX_USER= FRITZBOX_PASSWD= ZABBIX_SENDER_DEBUG=True PHPIZE_DEPS=autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c PHP_INI_DIR=/usr/local/etc/php PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 PHP_LDFLAGS=-Wl,-O1 -pie GPG_KEYS=*** PHP_VERSION=8.2.20 PHP_URL=https://www.php.net/distributions/php-8.2.20.tar.xz PHP_ASC_URL=https://www.php.net/distributions/php-8.2.20.tar.xz.asc PHP_SHA256=** HOME=/root

I run this in a docker container of Proxmox VE running an Ubuntu 22.04 template.

pthoelken commented 1 month ago

Did worked this anytime before for you or is this not working since day one?

geiasounai commented 1 month ago

It is not working since day one

pthoelken commented 1 month ago

When the container is up (errors doesn't matter) what is the output from this command here (again hide senstive data).

docker exec fritzmon_fritzbox-zabbix-monitoring_1 php status.php

geiasounai commented 1 month ago

When the container is up (errors doesn't matter) what is the output from this command here (again hide senstive data).

docker exec fritzmon_fritzbox-zabbix-monitoring_1 php status.php

root@fritzbox-zabbix-monitoring:~# docker exec root_monitor_1 php status.php isprouter totalBytesSent 1307644075 isprouter totalBytesReceived 3063869670 isprouter layer1UpstreamMaxBitRate 1250000000 isprouter layer1DownstreamMaxBitRate 2500000000 isprouter physicalLinkStatus Up

Fatal error: Uncaught SoapFault exception: [s:Client] UPnPError in /app/status.php:39 Stack trace:

0 /app/status.php(39): SoapClient->__call('GetInfo', Array)

1 {main}

thrown in /app/status.php on line 39

pthoelken commented 1 month ago

Did you use your FritzBox as normal internet router (as recommended from your isp) or for example as WiFi / switch extender only?

geiasounai commented 1 month ago

Did you use your FritzBox as normal internet router (as recommended from your isp) or for example as WiFi / switch extender only?

It operates as normal Internet Router

pthoelken commented 1 month ago

Which model? It seems to be that your Fritzbox does not support this item. Sorry for my bulk of questions but I only have the 7950 AX to test it.

lanhostconfigmgm and "urn:dslforum-org:service:LANHostConfigManagement:1"

geiasounai commented 1 month ago

I use the 5530 Fiber

pthoelken commented 1 month ago

Thanks, give me some time to investigate your model in case of this issue.

DRReim commented 4 weeks ago

Hello,

i got a similar issue. - Hostname required

Fritzbox 7590 - Zabbix server 7.0.2 running on debian 12 Dockerhost runnig on a proxmox LXC Container also debian 12 In zabbix my host the name is configured like the default -> fritz.box but I also tried out other names nothing helped

In the compose file I tried with " and without ", also tried the dev-18 too

/app # zabbix_sender -z 192.168.115.48 -i - -vv

zabbix_sender [39]: ERROR: [line 1] 'Hostname' required Sending failed.

/app # printenv

ZABBIX_SENDER_DEBUG=False HOSTNAME=0c9af3354d85 PHP_INI_DIR=/usr/local/etc/php SHLVL=1 HOME=/root TLS_PSK= PHP_LDFLAGS=-Wl,-O1 -pie FRITZBOX_IP=192.168.179.254 PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 FRITZBOX_PASSWD=** PHP_VERSION=8.2.17 GPG_KEYS=** PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 PHP_ASC_URL=https://www.php.net/distributions/php-8.2.17.tar.xz.asc PHP_URL=https://www.php.net/distributions/php-8.2.17.tar.xz TERM=xterm TLS_PSK_IDENTITY= PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin FRITZBOX_USER=Monitoring INTERVAL=30s PHPIZE_DEPS=autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c PWD=/app PHP_SHA256= ZABBIX_SERVER=192.168.115.48 FRITZBOX_HOSTNAME=fritz.box

/app # php status.php

fritz.box totalBytesSent 372423458 fritz.box totalBytesReceived 3082194351 fritz.box layer1UpstreamMaxBitRate 11859000 fritz.box layer1DownstreamMaxBitRate 48856000 fritz.box physicalLinkStatus Up fritz.box ipAddressFromRouter 192.168.179.254 fritz.box connectionStatus Connected fritz.box uptime 727061 fritz.box externalIPAddress **** fritz.box softwareVersion 154.07.59 fritz.box associatedDeviceDiscovery {"data":[]}

pthoelken commented 4 weeks ago

Thanks for your report. This issue is under investigation. I need some time to find the troublemaker. If you wanna help me feel free to investigate this either :-)

pthoelken commented 4 weeks ago

@DRReim can you post the permissions from your fritzbox user? Thanks. The router in your network is running as normal isp router and direct internet access point?

DRReim commented 3 weeks ago

@pthoelken, sure I'm also trying to find out what's wrong, but my PHP skills aren't really good. This project is awesome, finally some good monitoring for AVM Routers.

Here are the permissions from my fritbox user. image

Router is just setup as an internet router/modem, also doesn't do any firewalling, that's all handled by my opnsense. WLAN is disabled

FRITZ!OS is version 7.59

pthoelken commented 3 weeks ago

Just for testing, are you able set all permissions to the monitoring users (with vpn and so on) and test again. Thanks.

pthoelken commented 3 weeks ago

Really strange .. in my case; I have an new 7590 here and it works instant.

DRReim commented 3 weeks ago

Just for testing, are you able set all permissions to the monitoring users (with vpn and so on) and test again. Thanks.

tried it with a User that has "full" rights. Did setup a fresh docker server + container just in case, but also doesn't seem to work. in my firewall I allowed every port between the docker host, zabbix server and the fritzbox

just in case, here is the fritzbox host in zabbix

image

DRReim commented 3 weeks ago

Found the issue, was my fault. Forgot to set the Listenport for Zabbix Trappers, changed the port in the docker-compose file to 10051 after restarting the zabbix server and it works.

image

frizbox user has the recommended settings open ports are now restricted to 49000 (docker server -> fritzbox) and docker server -> zabbix host (10050 agent, 10051 agent trapper)

Thanks for the help and this awesome project! 👍

pthoelken commented 3 weeks ago

Perfect, thanks for your response and compliments. :-) just for my documentations, what was the error message from your docker container logs from the beginnging of the issue?

DRReim commented 3 weeks ago

My original error message were

docker compose logs _fritzbox-zabbix-monitoring | Using custom Zabbix Server port '10050' fritzbox-zabbix-monitoring | zabbixsender [8]: ERROR: [line 1] 'Hostname' required fritzbox-zabbix-monitoring | Sending failed. Use option -vv for more detailed output.

after that I did docker exec fritzbox-zabbix-monitoring php status.php

_Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /app/status.php:18 Stack trace:

0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://192.168....', 'urn:schemas-upn...', 1, false)

1 /app/status.php(18): SoapClient->__call('GetAddonInfos', Array)

2 {main}

thrown in /app/status.php on line 18_

allowed the docker server to access the fritzbox over port 49000 (in my firewall appliance) because different subnet status.php Error message went away and it grapped the data

docker compose logs fritzbox-zabbix-monitoring | Sending failed. Use option -vv for more detailed output. fritzbox-zabbix-monitoring | Sending failed. Use option -vv for more detailed output. repeat

did go into the container docker exec -it fritzbox-zabbix-monitoring sh zabbix_sender -z ZabbixServerIP -i - -vv

_zabbixsender [26]: ERROR: [line 1] 'Hostname' required Sending failed.

the error message really didn't help from the zabbix sender to solve this hope this helps

pthoelken commented 3 weeks ago

Thanks for your response. I have to integrate some checks for a better error handling in the next image.

@geiasounai check this message from here https://github.com/pthoelken/fritzbox-zabbix-monitoring/issues/18#issuecomment-2291053169 - maybe this solve your problem either.

erik-van-dijk commented 3 weeks ago

I'm getting the same error message ('Hostname' required), but seems to be another issue: docker exec fritzbox-zabbix-monitoring-monitor-1 php status.php fritz.box totalBytesSent 1718842744 fritz.box totalBytesReceived 3926947645 fritz.box layer1UpstreamMaxBitRate 999999000 fritz.box layer1DownstreamMaxBitRate 999999000 fritz.box physicalLinkStatus Up

Fatal error: Uncaught SoapFault exception: [HTTP] Unauthorized in /app/status.php:39 Stack trace:

0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://192.168....', 'urn:dslforum-or...', 1, false)

1 /app/status.php(39): SoapClient->__call('GetInfo', Array)

2 {main}

thrown in /app/status.php on line 39

I'm connecting to a FRITZ!Box 7560 running FRITZ!OS: [07.30-108052 PLUS].

EDIT: I fixed my issue! I was using a dollar sign in my Fritz password, which was not escaped in the yaml file. Changing to another password without dollar sign made it work.