Jump to content

Recommended Posts

Posted

Hi,

I would like to have a folder monitor, basically I have a folder (or several folders) that I need to monitor that the files in the folder and receive alerts for the following.

- files are older than X days
- over X number of files in the folder

 

Please advise if this is possible currently of if this will require development, if this can be accomplished with a script then some pointers would be useful, ideally this would run at the same rate as other aspects of the system, but it could also be a daily/hourly check as I understand it could consume time processing!

 

  • Staff
Posted

Hi,

try to run these scripts:

Check if folder contines files older than 10 days.

$fullPath = "path to the folder"
$days = 10 # files older than 10 days

$files = @(get-childitem $fullpath -include *.* -recurse | where {($_.LastWriteTime -lt (Get-Date).AddDays(-$days)) -and ($_.psIsContainer -eq $false)})
if($files.length -gt 0){exit 1}
else{exit 0}

Check if folder contains more than 5 files

$fullPath = "path to the folder"
$count = 5 # check if folder containes more than 5 files

$files = @(get-childitem $fullpath)
if($files.Count -gt $count){exit 1}
else{exit 0}

 

Posted

Thanks Chris, the script works fine, I can add some output to them, but it seems they require running manually? Is there a way to have scripts run at the same interval as other test, at the very least I would need to check hourly?

it would be great if this could be added in a similar format to the SSL so that multiple folders could be added with Alert times from 1 minute, happy to discus this offline.

I could do an automation script but there is not an option less than daily.

Many Thanks

  • Administrators
Posted

We'd love to have a folder monitoring feature in Pulseway. I've added a todo for it, this could be used to detect cryptolocker, see if backups aren't rotated and much more.

-Paul

  • 2 years later...
Posted

Any updates on this, also very interested as we have a few systems where monitoring the number of files or size of a queue folder would be very helpfull. As buildup means they are not being processed.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...