rbicelli / pfsense-zabbix-template

Zabbix Template for pfSense
Apache License 2.0
240 stars 107 forks source link

Not supported by Zabbix Agent #103

Closed misteradamx closed 1 year ago

misteradamx commented 2 years ago

Getting the following error with the Discovery rules and with some of the items, specifically any that have the pfsense.value key set. Not supported by Zabbix Agent

I'm running a pfsense+ appliance from NetGate .

21.05.2-RELEASE (amd64)
built on Fri Oct 22 15:24:02 UTC 2021
FreeBSD 12.2-STABLE

I am running Zabbix 5.0.19 and I've tried both agent packages (5.0.11 and 5.4.2).

rbicelli commented 2 years ago

Did you followed instructions? Did you configured the agent for active checks?

misteradamx commented 2 years ago

dUXhOqu 1 These are my settings in the Package Management. The server never fully sees the agent using the active port. Is this not set correctly? (In this screenshot, I also removed the ListenPort line to test)

I cannot find any documentation that accurately conveys how to set up the agent for this method or how to troubleshoot.

rbicelli commented 2 years ago

In server active you can omit the port. Hostname must match the hostname in zabbix.

misteradamx commented 2 years ago

In server active you can omit the port. Hostname must match the hostname in zabbix.

Hostname is the same as in Zabbix. If I use the normal agent setup with the normal port, it works. I have the agent line in Zabbix set to the IP and the port set to 10051. Is this correct?

randysrs commented 2 years ago

any update here ? version 5.4.2 upload newest XML's same issue . Pfsense 2.5,2 connected to local proxy
validated i can run /speedtest command from cli as expected validated php file image

GuillaumeHullin commented 2 years ago

@randysrs, in pfSense > Services > Cron, do you see the following line? /usr/local/bin/php /root/scripts/pfsense_zbx.php

What do you get if you run

# This should show the speediest result
cat /tmp/speedtest-em0

#This should parse the result and only give you the download speed
/usr/local/bin/php /root/scripts/pfsense_zbx.php if_speedtest_value em0 download

# Note that I'm assuming that your WAN is the interface em0 (check Interface > Assignments)
randysrs commented 2 years ago

Pfsense FW 1 results IGBx networks cards igb0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500 description: IGB0_WAN

@.***/usr/local/bin: /usr/local/bin/speedtest --list Retrieving speedtest.net configuration... Cannot retrieve speedtest configuration ERROR: <urlopen error [Errno 4] Non-recoverable failure in name resolution>

This firewall has IGB nics IDs @./usr/local/bin: cat /tmp/speedtest-igb0 @./usr/local/bin:

Firewall 2 with EMx network cards Pfsense FW 2 results

@randysrshttps://github.com/randysrs, in pfSense > Services > Cron, do you see the following line? /usr/local/bin/php /root/scripts/pfsense_zbx.php /15 * root /usr/local/bin/php /root/scripts/pfsense_zbx.php speedtest_cron

This was automatically installed is that the issue ?

What do you get if you run

This should show the speediest result

cat /tmp/speedtest-em0

{"download": 92700260.9610765, "upload": 92677893.35476193, "ping": 5.282, "server": {"url": http://lightspeed.rainierconnect.com:8080/speedtest/upload.php, "lat": "47.2414", "lon": "-122.4594", "name": "Tacoma, WA", "country": "United States", "cc": "US", "sponsor": "Rainier Connect", "id": "45844", "host": "lightspeed.rainierconnect.com:8080", "d": 41.65606530291725, "latency": 5.282}, "timestamp": "2022-02-15T22:01:03.564994Z", "bytes_sent": 116637696, "bytes_received": 116073636, "share": null, "client": {"ip": "66.114.154.110", "lat": "47.5579", "lon": "-122.1633", "isp": "Isomedia", "isprating": "3.7", "rating": "0", "ispdlavg": "0", "ispulavg": "0", "loggedin": "0", "country": "US"}}

This should parse the result and only give you the download speed

/usr/local/bin/php /root/scripts/pfsense_zbx.php if_speedtest_value em0 download

GuillaumeHullin commented 2 years ago

@randysrs sorry I made a typo, your cron seems fine.

Concerning this...

***@***.***/usr/local/bin: /usr/local/bin/speedtest --list
Retrieving speedtest.net configuration...
Cannot retrieve speedtest configuration
ERROR: <urlopen error [Errno 4] Non-recoverable failure in name resolution>

It seems that there is some kind of DNS issue here... can you run dig github.com and see who is the DNS of your pfSense.

randysrs commented 2 years ago

@.***/root: dig github.com

; <<>> DiG 9.16.16 <<>> github.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63818 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 1232 ;; QUESTION SECTION: ;github.com. IN A

;; ANSWER SECTION: github.com. 60 IN A 192.30.255.112

;; Query time: 36 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Wed Feb 16 00:54:09 PST 2022 ;; MSG SIZE rcvd: 55

From: Guillaume Hullin @.> Sent: Tuesday, February 15, 2022 5:07 PM To: rbicelli/pfsense-zabbix-template @.> Cc: Randy Loveless @.>; Mention @.> Subject: Re: [rbicelli/pfsense-zabbix-template] Not supported by Zabbix Agent (Issue #103)

@randysrshttps://github.com/randysrs sorry I made a typo, your cron seems fine.

Concerning this...

@./usr/local/bin<mailto:@./usr/local/bin>: /usr/local/bin/speedtest --list

Retrieving speedtest.net configuration...

Cannot retrieve speedtest configuration

ERROR: <urlopen error [Errno 4] Non-recoverable failure in name resolution>

It seems that there is some kind of DNS issue here... can you run dig github.com and see who is the DNS of your pfSense.

— Reply to this email directly, view it on GitHubhttps://github.com/rbicelli/pfsense-zabbix-template/issues/103#issuecomment-1040971745, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AN5N62MZA7LS7WJBPCDMZATU3L2B3ANCNFSM5M6MRUHQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.**@.>>

GuillaumeHullin commented 2 years ago

Ok. Run the following to make sure you have the latest speedtest package.

pkg update && pkg install -y  -g 'py*-speedtest-cli'

One other point, can you comment back via GitHub app or website but not by answering mail... somehow the output is hard to sort out quickly.

randysrs commented 2 years ago

pkg update && pkg install -y -g 'py*-speedtest-cli' Updating pfSense-core repository catalogue... pfSense-core repository is up to date. Updating pfSense repository catalogue... pfSense repository is up to date. All repositories are up to date. Updating pfSense-core repository catalogue... pfSense-core repository is up to date. Updating pfSense repository catalogue... pfSense repository is up to date. All repositories are up to date. Checking integrity... done (0 conflicting) The most recent versions of packages are already installed From: Guillaume Hullin @.> Sent: Wednesday, February 16, 2022 1:51 AM To: rbicelli/pfsense-zabbix-template @.> Cc: Randy Loveless @.>; Mention @.> Subject: Re: [rbicelli/pfsense-zabbix-template] Not supported by Zabbix Agent (Issue #103)

Ok. Run the following to make sure you have the latest speedtest package.

pkg update && pkg install -y -g 'py*-speedtest-cli'

One other point, can you comment back via GitHub app or website but not by answering mail... somehow the output is hard to sort out quickly.

— Reply to this email directly, view it on GitHubhttps://github.com/rbicelli/pfsense-zabbix-template/issues/103#issuecomment-1041305567, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AN5N62JKAUHTT6QWJ2KT2X3U3NXORANCNFSM5M6MRUHQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.**@.>>

GuillaumeHullin commented 2 years ago

Ok so if the package is installed correctly... it seems like a DNS issue with your pfSense.

In pfSense > System > General Setup

What is your DNS? Is it local or is it remote? What is your DNS Resolution Behavior

IMO, I would setup DNS as 1.1.1.1 (Cloudflare) and 8.8.8.8 (Google) and setup DNS resolution as "use Local then fall back to remote (Google/Cloudflare)"

Maybe you can try to set your remote DNS and set the DNS resolution as "use remote and ignore local". Be careful you might disturb your network if you are on a live environment. I would also advice a reboot in order to make sure your DNS are set in the system properly.

Then try again /usr/local/bin/speedtest --list

randysrs commented 2 years ago

current DNS 8.8.8.8 , 4.2.2.2 and 173.248.59.127

when i run /usr/local/bin/speedtest --list

Retrieving speedtest.net configuration... Cannot retrieve speedtest configuration ERROR: HTTP Error 404: Not Found

There must be something wrong with 8.8.8.8 and 4.2.2.2 ? i added 1.1.1.1 and speedtest list now returns info .

this still doesnt resolve the Zabbix Agent NOT Supported issue though .

misteradamx commented 2 years ago

I continue to have issues utilizing the templates. If I do an import and immediately try to run the Discovery rules, I got the following still: Cannot send request: wrong discovery rule type.

GuillaumeHullin commented 2 years ago

@misteradamx sorry I don't have time to re-read the thread it but concerning Cannot send request: wrong discovery rule type. this is completely normal and expected. The discovery items are Zabbix Active Agent... so you can't use Execute Now from your Zabbix Server.