Synthetics script to check file in the folder

Hello NR Expert,
Wondering if we can use Synthetics script to check number of files stored in a folder or a particular location let’s say S3 bucket or Azure Blob? And alert me if more than 20 files in the folder. If so any example script available to put me to the right direction? If so, how to create sample alert as such?

Your sincerely,

Hi, @charles12: You may be able to use an API test to call the AWS or Azure APIs and query the number of items in the bucket, and fail if the result is greater than 20.

Instead of Synthetics, however, I would recommend that you use one of the existing cloud integrations to pull in this data. You may then use an NRQL alert condition to notify you if a particular attribute exceeds some threshold.

1 Like

Not sure about Azure, but s3 bucket metrics for object counts is an infrequent metric out of the box. Like once a day. Using something to query the bucket is probably the only way. I might suggest a lambda that is triggered off bucket events to count and send metrics to NR or cloudwatch.

Thank you @philweber @6MM .

One last question - can I also leverage Synthetics to count the number of files in a file server (a folder) too? All the PDF is stored in a centralise folder.

It depends how you plan to connect to the file server. Synthetics scripts can connect to FTP servers, for example, but not Samba shares.