Shell Monitoring Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Monitoring Script
# 1  
Old 05-30-2015
Shell Monitoring Script

Hi guys,

I didn't understand this monitoring script request - I don't ask for the script result.

If you understand the request, I'm just asking an explanation to simplify it for me.

THE Script Request:

Our organization keeps various files in directories structured as events/files_detected/<year>/<month>/<day>/<hour>/<minute> e.g. events/files_detected/2010/11/02/07/53

* the script should count the number of files in the given directory (events_storage/files_constant_patterns) in the last 5 minutes and report:

* OK - if the number is greater than 100

* WARN - if the number is between 50 and 100

* CRITICAL - if the number is less than 50


Thanks!!
# 2  
Old 05-30-2015
The request seems ambiguous on several points, and I don't have any reason to think my crystal ball is any clearer than yours. Presumably, you know where this request came from and you have some insight into what they want. If that is true, your crystal is probably a lot clearer than mine.

At first glance I would say it is asking for the number of files in the 5 directories associated with the current minute, the previous minute, the minute before that, the minute before that, and the minute before that. Or maybe you should skip the current minute and just look at the 5 previous minutes (so file counts aren't artificially low due to the current minute being incomplete and files may still be added after you complete the count).

But:
  • Why say "count the number of files in the given directory" instead of "count the number of files in the given directories"?
  • Does "(events_storage/files_constant_patterns)" mean that instead of counting files in events/files_detected/2010/11/02/07/53 you should count files in events/files_detected/2010/11/02/07/53/events_storage/files_constant_patterns? Or in events/files_detected/2010/11/02/07/53/files_constant_patterns and in events/files_detected/2010/11/02/07/53/events_storage? Or does it mean that there are several types of files and you're only supposed to count files that are events_storage files or files_constant_patterns file? If so, what are events_storage files and files_constant_patterns files and how do you identify them?
  • Are the directory names based on local time or coordinated universal time? If it is local time and you are in a place where daylight savings time is observed, you will have one hour each year when files will be added to the directory during two different minutes. Are you supposed to adjust the limits during the second hour when files are being added to those directories? And, if so, what adjustments are you supposed to make?
  • Etc.
Good luck. Smilie
# 3  
Old 05-30-2015
Hiya

Since Don didnt post the template i'd expected (a certain phrase within there) to see, here we go Smilie

Quote:
Originally Posted by moshesa
...
Our organization keeps various files in directories structured as events/files_detected/<year>/<month>/<day>/<hour>/<minute> e.g. events/files_detected/2010/11/02/07/53

* the script should count the number of files in the given directory (events_storage/files_constant_patterns) in the last 5 minutes and report:
...
So basicly you need to identify the current minute, subtract 6 (current - 5 mentioned), and parse those folders with something like find or ls.
Then do the checking on that result.

hth
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script for continuously monitoring log file

Hi I have written below log monitoring script to egrep multiple words and redirect the output to a text file and its working fine but I want to add some more below given functionality to it, which is very advance and im not very good in it, so please help if you can :) I am egrepping all the... (1 Reply)
Discussion started by: scazed
1 Replies

2. UNIX for Beginners Questions & Answers

Server monitoring using shell script

I want to write a shell script which is used in cron job and it runs every 4 hours to check whether tomcat servers are running or not . If servers are not running , one email should be triggered like alert notification. if servers are Running then no need to print anything. This is what i want... (5 Replies)
Discussion started by: kk123
5 Replies

3. Infrastructure Monitoring

Recording / Monitoring Shell Script Resource Usage.

I need to record min and max resources for RAM, & CPU for each command's execution in a shell script. Maybe going in details I would also be interested to capture plots with resource usage i.e.start to end of individual command with respect to time in a shell script. Please share ideas. (0 Replies)
Discussion started by: vaibhavvsk
0 Replies

4. Shell Programming and Scripting

Monitoring Tomcat Service with shell script

Hello Forum, I have prepared script to monitor the tomcat status. Following is the script which will monitor tomcat instance. I need little modifcation in the script. My script will grep for process, the output of grep command will analyze by if condition under for loop and will send... (2 Replies)
Discussion started by: ooilinlove
2 Replies

5. Shell Programming and Scripting

WPAR monitoring shell script suggestions needed

Hi All, This is for WPAR monitoring shell script, earlier opened thread was closed, had to open a new thread, as suggested I have used script as below, But am trying to get the output in below format, need suggestions with it. Below is the lswpar output, required output format. ... (7 Replies)
Discussion started by: aix_admin_007
7 Replies

6. Shell Programming and Scripting

Shell script for process monitoring

Im having a bit of troble coming up with a script that does this monitors processes to see if they die, if they do die, restart the process and write out to a log file that the process was restarted with the new PID and the date and time the new process was launched. Any suggestions? (1 Reply)
Discussion started by: jspinal
1 Replies

7. Shell Programming and Scripting

Monitoring Tomcat Instance using shell script

Hello Forum, I have prepared script to monitor the tomcat status. Following is the script which will monitor tomcat instance.I need little modifcation in the script. My script will grep for java,the output of grep command will analyze by if condition under for loop and will send following echo... (7 Replies)
Discussion started by: coolguyamy
7 Replies

8. Shell Programming and Scripting

Shell Script for monitoring File system.

Hi, need help to write one shell script to monitor UNIX file systems and if any changes happend like deletion of any file, adding new file, time stamp changed, permisson changed etc. Script need to send alert mail to defined person/mail id. I request someone to help me to create the... (1 Reply)
Discussion started by: vjauhari
1 Replies

9. Shell Programming and Scripting

shell script for monitoring users activities

hi I need a shell script which runs perpetually in background and monitors different aspects of different users on different files and their usages for example say there r 3 users so i want when they log in i.e. their log in time and their file access, modify and change log of each file of a... (3 Replies)
Discussion started by: rrd1986
3 Replies

10. Shell Programming and Scripting

Weblogic monitoring shell script

HI, I'm new in unix. I would like to know if you have a ready script for monitoring the weblogic and managed servers. I want to have a script that checks the weblogic once in a while if it's up and running. if not running, will send an email to me. any idea? please help me. i will... (4 Replies)
Discussion started by: tungaw2004
4 Replies
Login or Register to Ask a Question