centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
310 stars 273 forks source link

--plugin=apps::protocols::ftp::plugin command get #4605

Closed guillaumechardin closed 1 year ago

guillaumechardin commented 1 year ago

Hello, it seems that FTP plugin fails on get command even if it actualy works. I upgrade to the lastest version today : centreon-plugin-Applications-Protocol-Ftp-20230810-100132.el8.noarch

I try to check a ftp server (filezilla server) with pu/get/delete command set.

Running from shell seems to be ok :

]# /usr/lib/centreon/plugins//centreon_protocol_ftp.pl --plugin=apps::protocols::ftp::plugin --hostname=fqdn --mode=commands --username="user" --password="pwd" --ftp-command="get,/testwrite.txt" OK: Response time 0.047 | 'time'=0.047;;;;

Command definition: $CENTREONPLUGINS$/centreon_protocol_ftp.pl --plugin=apps::protocols::ftp::plugin --hostname=$HOSTADDRESS$ --mode=commands --username="$_SERVICEFTP_USER$" --password="$_SERVICEFTP_PASSWORD$" --ftp-command="get,testwrite.txt"

Now from centreon : it fails : image

From the server side view it succeed and after that an empty command seems to be issued, below some info from FTP server log.

2023-08-21T12:56:54.548Z << [FTP Session 1891864 x.x.x.x] 220-FileZilla Server 1.4.1
2023-08-21T12:56:54.548Z << [FTP Session 1891864 x.x.x.x] 220 Please visit https://filezilla-project.org/
2023-08-21T12:56:54.548Z >> [FTP Session 1891864 x.x.x.x] USER myUser
2023-08-21T12:56:54.548Z << [FTP Session 1891864 x.x.x.x] 331 Please, specify the password.
2023-08-21T12:56:54.548Z >> [FTP Session 1891864 x.x.x.x] PASS ****
2023-08-21T12:56:54.563Z << [FTP Session 1891864 x.x.x.x myUser] 230 Login successful.
2023-08-21T12:56:54.563Z >> [FTP Session 1891864 x.x.x.x myUser] PASV
2023-08-21T12:56:54.563Z << [FTP Session 1891864 x.x.x.x myUser] 227 Entering Passive Mode (x,x,x,x,217,120)
2023-08-21T12:56:54.563Z >> [FTP Session 1891864 x.x.x.x myUser] RETR testwrite.txt
2023-08-21T12:56:54.563Z << [FTP Session 1891864 x.x.x.x myUser] 150 About to start data transfer.
2023-08-21T12:56:54.579Z << [FTP Session 1891864 x.x.x.x myUser] 226 Operation successful
2023-08-21T12:56:54.579Z >> [FTP Session 1891864 x.x.x.x myUser] 
2023-08-21T12:56:54.579Z << [FTP Session 1891864 x.x.x.x myUser] 501 What are you trying to do? Go away.
2023-08-21T12:56:54.579Z == [FTP Server] Session 1891864 ended gracefully.

Line before "error 501" is not seen when commands are run from bash interactively.

garnier-quentin commented 1 year ago

With centengine service, the user is centreon-engine and the default directory is /. I think it s the issue. You should move your current directory

guillaumechardin commented 1 year ago

Ok, specifying local destination full path correct the issue : --ftp-command="get,testwrite,/tmp/testwrite.txt"