Skip to main content
Good morning,I would like to make modbus requests with centreon.But when I want to run my request, I get an error UNKOWN: Unable to open a connection at TCP.pm line 56.I think I'm missing a few things.

hello

to help you, could you provide more information, mainly the command generated by centreon (from the information tab)

and the result of said command directly from the SSH shell of the poller (using su - centreon-engine)

 

you can hide your private information, and also try to run the same command by adding --debug at the end in the shell


My command: 

perl /usr/lib/centreon/plugins//centreon-plugins/centreon_plugins.pl --plugin=apps::protocols::modbus::plugin --mode=numeric-value --tcp-host=10.XX.XX.XX --config=modbus_config.json --verbose
 

And the file modbus_config.json :

{
    "selection":{
        "temp":{
            "address": 200,
            "quantity": 1,
            "type": "holding",
            "display": true
        }
    },
    "formatting": {
        "printf_msg": "My metric '%s' value is %.2f",
        "printf_var": "$self->{result_values}->{instance}, $self->{result_values}->{value}"
    }
}
 

The answer :

UNKNOWN: Unable to open a connection at /usr/local/share/perl5/5.32/Device/Modbus/TCP.pm line 56.


ok, from the poller ssh shell, could you test 

ping your-ip

(the ping may be forbidden, depending on the host)

 

and : telnet your-ip 502

the default TCP port for modbus is 502, it should return an output saying “connected”, if not there is a communication error between your poller and the modbus host, check your firewall or network settings


The Ping is OK

The Telnet return is connected, escape character is ‘^]’


hmm i see something strange in your previous post, what are you using to run the poller?

it looks like you are using a copy of the centreon plugin github repo, and I see that there were issues a few years ago with the modbus perl module that was missing

I don’t use the plugin from the github unfortunately, I use the plugin pack, but thing I see above is a reference to a perl script in this folder /usr/local/share/perl5/5.32/ which I don’t have on my pollers

 

that problem you have is something in the modbus library from perl,  are you using an updated plugin (you could try to git clone the current version of the github in another folder and test you command line just by changing the folder)

outside of that, I cannot help you more, be sure to also update your perl library (cpan?, no idea how you have this installed)


Yes I’m using plugin from github. I use the last version.


then maybe an issue with the way it talks to the modbus plugin from perl… I would suggest you to open an issue on the github, maybe something has been broken in a recent update.

or see if someone else here has a solution, but I don’t have more information.


OK

perl-Device-Modbus-TCP                                     noarch               0.026-1.el9                       @local-centreon-24.04-noarch 

but the module perl modbus came from centreon dépot


Reply