What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

FTP Sensor set to error on Login incorrect

Votes:

0

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?

check ftp login prtg

Created on Jan 18, 2017 10:50:04 AM



Best Answer

Accepted Answer

Votes:

1

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;

Created on Jan 19, 2017 7:18:54 AM



2 Replies

Votes:

0

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.

Created on Jan 18, 2017 12:28:40 PM by  Torsten Lindner [Paessler Support]



Accepted Answer

Votes:

1

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;

Created on Jan 19, 2017 7:18:54 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.