OPNsense-Dashboard icon indicating copy to clipboard operation
OPNsense-Dashboard copied to clipboard

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

Open digibaro opened this issue 1 year ago • 9 comments

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();

digibaro avatar Feb 01 '24 09:02 digibaro

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

cyberpunked1985 avatar Feb 02 '24 06:02 cyberpunked1985

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

th3voic3 avatar Feb 02 '24 07:02 th3voic3

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.

digibaro avatar Feb 02 '24 08:02 digibaro

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

dicepvp avatar Feb 09 '24 02:02 dicepvp

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

digibaro avatar Feb 09 '24 21:02 digibaro

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

jsa91 avatar Feb 20 '24 16:02 jsa91

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?

superczar avatar Feb 29 '24 18:02 superczar

@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.

Taralas avatar May 01 '24 15:05 Taralas

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.

TheDublord avatar Jul 07 '24 02:07 TheDublord