bsmithio / OPNsense-Dashboard

A functional and useful dashboard for OPNsense that utilizes InfluxDB, Grafana, Graylog, and Telegraf.
511 stars 64 forks source link

Error message in Telegraf logging relating to telegraf_pfifgw.php after upgrade to OPNsense 24.1 #57

Open digibaro opened 7 months ago

digibaro commented 7 months ago

After the upgrade to OPNSense 24.1 the following error messages are shown which results in no Firewall (drops/country/firewall) and Interface information visible in the OPNSense dashboard. The CPU/Memory graphs are fine

I experimented with non-root and root rights for Telegraf in the OPNSense GUI.

Telegraf log error message in OPNSense GUI E! [inputs.exec] Error in plugin: exec: exit status 255 for command "sudo /usr/local/bin/telegraf_pfifgw.php":

CLI error message in OPNSense root@firewall:/usr/local/bin # sudo telegraf_pfifgw.php

Fatal error: Uncaught Error: Call to undefined function get_interfaces_info() in /usr/local/bin/telegraf_pfifgw.php:13 Stack trace:

0 {main}

thrown in /usr/local/bin/telegraf_pfifgw.php on line 13

It looks like some function get_interfaces_info(); has been removed fom require_once("interfaces.inc");

$ifsinfo = get_interfaces_info();

cyberpunked1985 commented 7 months ago

Same issue here, all after the 24.1 opnsense upgrade, telegraf_pfifgw.php getting errors. Possible opnsense problem?

th3voic3 commented 7 months ago

To add to this. The function get_interfaces_info was removed in this commit: https://github.com/opnsense/core/commit/4d495ea6cc3d3c993662867bf3b3a072069e1fc8

See: https://github.com/dblanque/opnsense-zabbix/issues/1

digibaro commented 7 months ago

I copied the function (block) get_interfaces_info from interfaces.inc (23.x) to the script telegraf_pfifgw.php under the require_once statements.

Now the script works again. Up to the owner to add the function to the script or transform it to available OPNSense 24.1 functions.

dicepvp commented 7 months ago

i am a little bit confused on how to fix this issue myself. like what exactly am i supposed to copy into the telegraf_pfifgw.php. could someone send me the exact file please

digibaro commented 7 months ago

i am a little bit confused on how to fix this issue myself. like what exactly am i supposed to copy into the telegraf_pfifgw.php. could someone send me the exact file please

The requested file. I hope nothing breaks with the conversion between OS and editors.

telegraf_pfifgw.php.txt

jsa91 commented 6 months ago

The requested file. I hope nothing breaks with the conversion between OS and editors.

telegraf_pfifgw.php.txt

Thank you! I found typo starting at line 105 though. Here is a corrected version:

telegraf_pfifgw.php.txt

superczar commented 6 months ago

Thank you @jsa91 This fixed my problem too.

one minor issue - The gateway summary panel shows all gateways as unmonitored although that is not the case. Any pointers to what could be causing this?

Taralas commented 4 months ago

@superczar Same on my end. This is a good workaround, but it would be nice to get this updated to work with the current supported versions.

TheDublord commented 2 months ago

The requested file. I hope nothing breaks with the conversion between OS and editors. telegraf_pfifgw.php.txt

Thank you! I found typo starting at line 105 though. Here is a corrected version:

telegraf_pfifgw.php.txt

For me, even with the new file I get the same error in the Telegraf OPNsense log, but the command line error is "No input file specified". There doesnt appear to be anything in the file itself echoing that, so many it is an issue with PHP. I havent gotten any further in the install process so I dont know if its just a missing dep. After running sudo telegraf_pfifgw.php I used echo $? to get the exit code of the last command and as mentioned, its exiting with 255.

EDIT: I think I fixed it by enabling RFC5424 and making sure my remote logging is enabled.