Open c-kr opened 1 day ago
The plan to solve the bug involves addressing the dynamic method call issue and ensuring that all necessary modules are correctly loaded in the embedded Perl (ePN) environment. The error message indicates that the run_plugin
method cannot be located, which suggests a problem with how the method is being called or how the modules are being loaded. By ensuring that the modules are available and the dynamic method call is correctly constructed, we can restore ePN functionality.
The bug is likely caused by the dynamic method call to run_plugin
in the check_nwc_health.pl
script. The error message indicates that the method cannot be located, which suggests that the package or method is not correctly defined or accessible in the ePN environment. This issue may have been introduced by changes in commit 2cd3c8d33adec16f19c01d0e1223d3a31408caa6
, which could have affected how modules are loaded or how dynamic method calls are handled.
To address the issue, we need to ensure that the run_plugin
method is correctly defined and accessible. We can modify the check_nwc_health.pl
script to explicitly require the necessary modules and ensure that the dynamic method call is correctly constructed. Here is a potential code snippet to address the issue:
# Ensure required modules are loaded
use Monitoring::GLPlugin;
use Monitoring::GLPlugin::SNMP;
use Monitoring::GLPlugin::UPNP;
# Initialize the plugin object
my $plugin_class = 'Monitoring::GLPlugin::SNMP::CheckNwcHealth';
my $plugin = $plugin_class->new();
# Set modes and arguments
$plugin->set_modes(...);
$plugin->set_arguments(...);
# Execute the plugin
$plugin->run_plugin();
By explicitly requiring the necessary modules and directly calling the run_plugin
method on the plugin object, we can ensure that the method is correctly defined and accessible.
To replicate the bug, follow these steps:
Build versions 2cd3c8d33adec16f19c01d0e1223d3a31408caa6
and 399dc41f652440fbee17683d0d8450c3acaa802a
.
Set up a test environment, such as an Ubuntu 20.04 Docker container.
Install the necessary packages:
apt install mod-gearman-tools mod-gearman-worker
mkdir /usr/share/mod_gearman/ && ln -s /usr/share/mod_gearman/mod_gearman_p1.pl /usr/share/mod_gearman/mod_gearman_p1.pl
Use mod_gearman_mini_epn
to test ePN for both built versions:
2cd3c8d33adec16f19c01d0e1223d3a31408caa6
, you should see the error indicating that the run_plugin
method cannot be located.399dc41f652440fbee17683d0d8450c3acaa802a
, the plugin should work as expected.By following these steps, you can replicate the bug and verify the solution.
Click here to create a Pull Request with the proposed solution
Files used for this task:
Hi, check_nwc_health is supposed to run in an OMD environment. At our customer sites we have thouands of checks which are running without problem. Actually the commit you mentioned was made in such a high-volume installation and ePN-errors did only occur on rare occasions then. Did you rename the plugin? It has to be started from a file named check_nwc_health. Gerhard
From: Christopher Kreft @.> Sent: Sunday, October 13, 2024 9:55 AM To: lausser/check_nwc_health @.> Cc: Subscribed @.***> Subject: [lausser/check_nwc_health] Is check_nwc_health ePN broken? (Issue #339)
Background:
Problem:
Steps to Reproduce:
2cd3c8dhttps://github.com/lausser/check_nwc_health/commit/2cd3c8d33adec16f19c01d0e1223d3a31408caa6 and https://github.com/lausser/check_nwc_health/commit/399dc41f652440fbee17683d0d8450c3acaa802a 399dc41https://github.com/lausser/check_nwc_health/commit/399dc41f652440fbee17683d0d8450c3acaa802a .
apt install mod-gearman-tools mod-gearman-worker mkdir /usr/share/mod_gearman/ && ln -s /usr/share/mod-gearman/mod_gearman_p1.pl /usr/share/mod_gearman/mod_gearman_p1.pl
This fixes the mod_gearman_p1.pl path.
Use mod_gearman_mini_epn to test ePN for both built versions:
2cd3c8dhttps://github.com/lausser/check_nwc_health/commit/2cd3c8d33adec16f19c01d0e1223d3a31408caa6 :
@.*:~# mod_gearman_mini_epn /data/check_nwc_health_2cd3c8d33adec16f19c01d0e1223d3a31408caa6/plugins-scripts/check_nwc_health plugin return code: 3 perl plugin output: 'ePN /data/check_nwc_health_2cd3c8d33adec16f19c01d0e1223d3a31408caa6/plugins-scripts/check_nwc_health: plugin did not call exit() **ePN /data/check_nwc_health_2cd3c8d33adec16f19c01d0e1223d3a31408caa6/plugins-scripts/check_nwc_health: "Can't locate object method "run_plugin" via package "ModGearmanP1.pl" (perhaps you forgot to load "ModGearmanP1.pl"?) at (eval 1) line 98870,".
* Works with <https://github.com/lausser/check_nwc_health/commit/399dc41f652440fbee17683d0d8450c3acaa802a>
399dc41https://github.com/lausser/check_nwc_health/commit/399dc41f652440fbee17683d0d8450c3acaa802a :
@.***:~# mod_gearman_mini_epn /data/check_nwc_health_399dc41f652440fbee17683d0d8450c3acaa802a/plugins-scripts/check_nwc_health
plugin return code: 3
perl plugin output: 'Usage: check_nwc_health [ -v|--verbose ] [ -t
Question:
Is ePN usage via mod-gearman still supported or is our environment too outdated? Alternatively, could there be a bug introduced by the changes in commit https://github.com/lausser/check_nwc_health/commit/2cd3c8d33adec16f19c01d0e1223d3a31408caa6
2cd3c8dhttps://github.com/lausser/check_nwc_health/commit/2cd3c8d33adec16f19c01d0e1223d3a31408caa6 that prevents ePN from functioning correctly?
— Reply to this email directly, view it on GitHubhttps://github.com/lausser/check_nwc_health/issues/339, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AABQSOGXL6N6FN3FKCDK4ALZ3IRPVAVCNFSM6AAAAABP3F5642VHI2DSMVQWIX3LMV43ASLTON2WKOZSGU4DGNZWGE4TSNY. You are receiving this because you are subscribed to this thread.
From: Christopher Kreft @.> Sent: Sunday, October 13, 2024 9:55 AM To: lausser/check_nwc_health @.> Cc: Subscribed @.***> Subject: [lausser/check_nwc_health] Is check_nwc_health ePN broken? (Issue #339)
Background:
Problem:
Steps to Reproduce:
2cd3c8dhttps://github.com/lausser/check_nwc_health/commit/2cd3c8d33adec16f19c01d0e1223d3a31408caa6 and https://github.com/lausser/check_nwc_health/commit/399dc41f652440fbee17683d0d8450c3acaa802a 399dc41https://github.com/lausser/check_nwc_health/commit/399dc41f652440fbee17683d0d8450c3acaa802a .
apt install mod-gearman-tools mod-gearman-worker mkdir /usr/share/mod_gearman/ && ln -s /usr/share/mod-gearman/mod_gearman_p1.pl /usr/share/mod_gearman/mod_gearman_p1.pl
This fixes the mod_gearman_p1.pl path.
Use mod_gearman_mini_epn to test ePN for both built versions:
2cd3c8dhttps://github.com/lausser/check_nwc_health/commit/2cd3c8d33adec16f19c01d0e1223d3a31408caa6 :
@.*:~# mod_gearman_mini_epn /data/check_nwc_health_2cd3c8d33adec16f19c01d0e1223d3a31408caa6/plugins-scripts/check_nwc_health plugin return code: 3 perl plugin output: 'ePN /data/check_nwc_health_2cd3c8d33adec16f19c01d0e1223d3a31408caa6/plugins-scripts/check_nwc_health: plugin did not call exit() **ePN /data/check_nwc_health_2cd3c8d33adec16f19c01d0e1223d3a31408caa6/plugins-scripts/check_nwc_health: "Can't locate object method "run_plugin" via package "ModGearmanP1.pl" (perhaps you forgot to load "ModGearmanP1.pl"?) at (eval 1) line 98870,".
* Works with <https://github.com/lausser/check_nwc_health/commit/399dc41f652440fbee17683d0d8450c3acaa802a>
399dc41https://github.com/lausser/check_nwc_health/commit/399dc41f652440fbee17683d0d8450c3acaa802a :
@.***:~# mod_gearman_mini_epn /data/check_nwc_health_399dc41f652440fbee17683d0d8450c3acaa802a/plugins-scripts/check_nwc_health
plugin return code: 3
perl plugin output: 'Usage: check_nwc_health [ -v|--verbose ] [ -t
Question:
Is ePN usage via mod-gearman still supported or is our environment too outdated? Alternatively, could there be a bug introduced by the changes in commit https://github.com/lausser/check_nwc_health/commit/2cd3c8d33adec16f19c01d0e1223d3a31408caa6
2cd3c8dhttps://github.com/lausser/check_nwc_health/commit/2cd3c8d33adec16f19c01d0e1223d3a31408caa6 that prevents ePN from functioning correctly?
— Reply to this email directly, view it on GitHubhttps://github.com/lausser/check_nwc_health/issues/339, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AABQSOGXL6N6FN3FKCDK4ALZ3IRPVAVCNFSM6AAAAABP3F5642VHI2DSMVQWIX3LMV43ASLTON2WKOZSGU4DGNZWGE4TSNY. You are receiving this because you are subscribed to this thread.
Hi Gerhard,
thanks for your feedback first.
Actually the commit you mentioned was made in such a high-volume installation and ePN-errors did only occur on rare occasions then
Thats really strange. We can reproduce it every time with a single call without any arguments, as mentioned in my post above (see exact steps to reproduce). If you cant reproduce it maybe your environment differs. Do you use OMD with mod_gearman or do you use embedded perl directly inside the monitoring core? Or maybe you use the go worker instead of the deprecated one? Could this be the issue? Maybe the implementation of ePN differs between mod_gearman C, mod_gearman go and directly inside the monitoring core as they use different p1.pl files?
Did you rename the plugin?
No, i just renamed the folders for reference but did not rename the plugin (... /plugins-scripts/check_nwc_health)
Mod-Gearman (Go, the old C-worker is completely outdated and yes, the ePN implementations are different. In the moment the Go-worker was released, we deprecated all the old workers in all our installations)
Background:
Problem:
Steps to Reproduce:
Build versions 2cd3c8d33adec16f19c01d0e1223d3a31408caa6 and 399dc41f652440fbee17683d0d8450c3acaa802a.
Use a simple test environment (e.g., start an Ubuntu 20.04 Docker container) and run the following commands:
This fixes the
mod_gearman_p1.pl
path.Use
mod_gearman_mini_epn
to test ePN for both built versions:Error with 2cd3c8d33adec16f19c01d0e1223d3a31408caa6:
Works with 399dc41f652440fbee17683d0d8450c3acaa802a:
Question:
Is ePN usage via mod-gearman still supported or is our environment too outdated? Alternatively, could there be a bug introduced by the changes in commit 2cd3c8d33adec16f19c01d0e1223d3a31408caa6 that prevents ePN from functioning correctly?