Hi,

we monitor an FTP server with the FTP Sensor and added credentials to check a successful login.

However if I change the password of the user the sensor status in Status "OK" with message "530- Login incorrect". I found this to be the behavior mentioned in https://www.paessler.com/manuals/prtg/ftp_sensor.

Is there a FTP Login sensor or a setting where I can set the status of the sensor to Error in the event of a failed login?


Article Comments

Hello,

Thank you for your KB-Post. I'm very much afraid the built in FTP-Sensor cannot be changed in its behaviour here indeed. The only option would be to do this with a custom script as an Exe (Advanced) Sensor I'm afraid.

best regards.


Jan, 2017 - Permalink

Hi,

thanks for the reply.

For anyone else trying to check for a working login see the script below with an EXE/Script sensor.

Param(
	    [string]$url = "ftp://ftp.example.com/",
	    [string]$username="username",
    	    [string]$password="password",
            [string]$ftp_fail_return_value="(530)"

)

$Request = [System.Net.WebRequest]::Create($url)
$Request.Method = [System.Net.WebRequestMethods+Ftp]::ListDirectoryDetails
$Request.Credentials = New-Object System.Net.NetworkCredential $username, $password


Try
{
    $Response = $Request.GetResponse()
}
Catch
{
   # Debug: check $_.Exception.Message for the FTP return value
   #"Exception.Message: "
   #$_.Exception.Message
   
   if ($_.Exception.Message -match $ftp_fail_return_value){
        Write-Host "4:Login failed"
        exit 4;
   }
   else{ # all other exceptions generate a System Error
         Write-Host "2:Unknown Error"
        exit 2;

   }
   Break

}

Write-Host "0:Login OK"
exit 0;

Jan, 2017 - Permalink