Processing missing files

Avatar

Avatar
Validate 10
Level 3
Partha18
Level 3

Likes

19 likes

Total Posts

29 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 3
Partha18
Level 3

Likes

19 likes

Total Posts

29 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
Partha18
Level 3

02-10-2019

Hi,

I am working on file collector activity. If there is no files in the directory for 2 days, then i need to get alert.

How can i make this possible?

In file collector, I will check 'process missing file'. And then alert activity. But in between my file collector and alert activity what i need to do?

Important Note: In file collector activity, we scheduled for each 2 hours daily. So per day it will check the directory for 12 times. And so 24 times for 2 days. After this check, if no file is there in my directory, i need to notified.

Please help me with this!

Thanks and Regards,

Partha.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

03-10-2019

Hi,

If you're on Linux: make a new js activity and paste this in, put after scheduler activity or anywhere really:

var DIR = '/absolute/path/to/collector/dir';

var DAYS_UNTIL_THINGS_START_LOOKING_SUSPICIOUS = 2;

var modified = new Date();

modified.setTime(execCommand('stat -c %Y ' + DIR)[1] * 1000);

if((new Date() - modified) / (86400 * 1000) > DAYS_UNTIL_THINGS_START_LOOKING_SUSPICIOUS)

  logError('Error: Collector directory last updated too long ago: ' + modified);

Thanks,

-Jon

Answers (2)

Answers (2)

Avatar

Avatar
Boost 50
MVP
Jyoti_Y
MVP

Likes

89 likes

Total Posts

123 posts

Correct reply

55 solutions
Top badges earned
Boost 50
Shape 1
Boost 5
Give Back 5
Give Back 3
View profile

Avatar
Boost 50
MVP
Jyoti_Y
MVP

Likes

89 likes

Total Posts

123 posts

Correct reply

55 solutions
Top badges earned
Boost 50
Shape 1
Boost 5
Give Back 5
Give Back 3
View profile
Jyoti_Y
MVP

09-10-2019

Hi Partha,

Answer to your two questions are:

1) Yes, vars.recCount works if there's any fie, it will give you value greater than zero.

2) You can set option value using:

var myOption=GetOption("myOption");

setOption("myOption",myOption+1);

Thanks,

Jyoti

Avatar

Avatar
Validate 10
Level 3
Partha18
Level 3

Likes

19 likes

Total Posts

29 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 3
Partha18
Level 3

Likes

19 likes

Total Posts

29 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
Partha18
Level 3

09-10-2019

Hi,

I am not using Linux.

In my case, A file will generate for every 1 hour in SFTP. So i need to notify when there is no file for 2 days. My file name is like eg: abcd* (abcd_followed by 6 digit random number. so i gave abcd* in file collector).

I have created a option "myOption" (type integer; value 0)

Below is my workflow:

1842529_pastedImage_2.png

i have 2 questions. My questions are,

1) In test activity, I have given vars.recCount > 0, then enable 'True'.

As i don't know my exact file name, i have given vars.recCount > 0. Will this work?

2) If file exist, i will make option value as 0. But for every 1 hour, if file is not there, then i need to do increment. How can i increment my option value. Either like SetOption('myOption',myOption+1) or someother thing?

Please help me with this!

Thanks and regards,

ParthaSarathy.