How to configure a check command with a comma "," inside the command? How to manage this character?
FTP plugin apps::protocols::ftp::plugin FTP command GET or PUT File myfile.pdf
The command below work as excepted: /usr/lib/centreon-plugins/src/centreon_plugins.pl --plugin apps::protocols::ftp::plugin --hostname ftp.mysite.com --username usertest --password passwordtest --mode commands --ftp-command get,myfile.pdf
When you configure it in the GUI, we got some plugin error like CRITICAL: Command 'get' issue: [Net::FTP] Timeout This is because of the comma in the command (get,myfile.pdf)
I've tryed some escape method, enabled shell and many tricks but without lucky.
Anyone have experimented the same behaviour and what's the solution? Thanks a lot
define service { host_name my.site.com service_description Application FTP GET check_command Application_FTP_GET!usertest!passwordtest!get!myfile.pdf register 1 use Application FTP GET _SERVICE_ID 567 }
Hello,
I have created a service using your configuration elements. I encountered a problem of rights when the script was run as centreon-engine, I received the following error message:
/usr/lib/centreon-plugins/src/centreon_plugins.pl --plugin apps::protocols::ftp::plugin --hostname 172.16.5.13 --username testuser --password testuser --mode commands --ftp-command get,myfile.pdf Cannot open Local file myfile.pdf: Permission denied at /usr/lib/centreon-plugins/src/apps/protocols/ftp/lib/ftp.pm line 42. CRITICAL: Command 'get' issue: No transfer to ABOR.
This problem could be solved by specifying a destination path for which the centreon-engine user had write rights.
I added this destination path as an argument and the script returned the expected result :
define service { host_name 172.16.5.13 service_description App-FTP-GET-custom register 1 use App-FTP-GET-custom _SERVICE_ID 363 }
However I think that your timeout error is not related to the comma but could rather come from a problem with name resolution or network communication.
Could you provide the screenshot (or paste it as text) of the full command :
Hi,
Thanks for taking over my issue!
Hostname, username, password and file are examples. You can’t download the file directly.
The command line work, the problem is only present in the GUI when you configure check command, because of the “comma” in the line. “--ftp-command get,myfile.pdf”
Thanks
Ciao
stefano
Hello,
Please show me the result in CLI executed with centreon-engine like :
And like previously asked, the command displayed on the GUI. (to see if the command is correctly interpreted)
Hi,
I get exactly the same result with CLI. As writer before the CLI work
OK: Response time 0.211 | 'time'=0.211;;;;
All that displayed on the GUI are on the screenshots from the first post, do you need other informations?
This is the result
I’ve also tried to specify destination and we got the same issue. This is not permissions nor network related issue. In the production server we use real hostname of the FTP server.
I’m pretty sure that the comma is the problem. Maybe do you know how we can “escape” it?
Again thank you very much, your help is much appreciated
Ciao
stefano
@stefanotoro When I talk about the command statement, I’m talking about the command that is going to be executed by centreon-engine, you can find in the right pannel :
When you copy/paste this command in “centreon-engine” shell, is this the same command that the one that is working ?
Hi,
Yes, it’s exactly the same.
Thanks
Ciao
stefano
@selkostali
Hi, you’re right, it’s a permission issue.
I send the file to /tmp and now it work.
This is definitely not a “comma” issue.
Thank you very much for your time and your precious testing
Ciao
stefano
Hello @stefanotoro !
Glad to hear it! (Don't hesitate to mark the post as "solved")