Imported Upstream version 1.07
This commit is contained in:
		
							parent
							
								
									87e0216b00
								
							
						
					
					
						commit
						a8f50c0a7c
					
				
					 53 changed files with 15751 additions and 0 deletions
				
			
		
							
								
								
									
										10
									
								
								samples/README
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								samples/README
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
sample.ini - you can use this as a template to make other configuration
 | 
			
		||||
             files. It has lots of comments at the beginning to remind
 | 
			
		||||
             you of what's allowed
 | 
			
		||||
sample2.ini - sample configuration file to alert when more than 10% 
 | 
			
		||||
               of a processes is in use. 
 | 
			
		||||
solaris.ini - System processes that you might want to check on, customized
 | 
			
		||||
              for Solaris. Checks that cron and syslogd are running,
 | 
			
		||||
	      and that no process uses more than 70% of the available CPU.
 | 
			
		||||
 | 
			
		||||
$Id: README,v 1.2 2000/04/09 20:40:43 rocky Exp $
 | 
			
		||||
							
								
								
									
										13
									
								
								samples/port-watch.ini
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								samples/port-watch.ini
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
# $Id: port-watch.ini,v 1.1 2004/09/07 13:51:08 rockyb Exp $
 | 
			
		||||
 | 
			
		||||
# Here is an example to show how to use ps-watcher to do something
 | 
			
		||||
# not really possible from ps: check to see if a *port* is active.
 | 
			
		||||
# We make use of lsof to check port 3333 and the $PROLOG make
 | 
			
		||||
# sure it runs.
 | 
			
		||||
 | 
			
		||||
[$PROLOG]
 | 
			
		||||
  occurs  = first
 | 
			
		||||
  trigger = { \$x=`lsof -i :3333 >/dev/null 2>&1`; \$? >> 8 }
 | 
			
		||||
  action  = <<EOT
 | 
			
		||||
  put-your-favorite-command-here arg1 arg2 ...
 | 
			
		||||
EOT
 | 
			
		||||
							
								
								
									
										19
									
								
								samples/root-procs.ini
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								samples/root-procs.ini
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
# $Id: root-procs.ini,v 1.1 2008/12/25 17:01:50 rockyb Exp $
 | 
			
		||||
# Test perl-action, prolog and epilog
 | 
			
		||||
# Rather the name of the interpreter is listed (e.g. bash or perl)
 | 
			
		||||
# Here's how you can match against a script.
 | 
			
		||||
# Look for my processes: ps-watcher.
 | 
			
		||||
[$PROLOG]
 | 
			
		||||
  perl-action = $my_count=0; $root_procs=0;
 | 
			
		||||
[.*]
 | 
			
		||||
  perl-action = <<EOP
 | 
			
		||||
  if ($uid == 0) { 
 | 
			
		||||
    $root_procs++;
 | 
			
		||||
  } 
 | 
			
		||||
EOP
 | 
			
		||||
  occurs  = every
 | 
			
		||||
[$EPILOG]
 | 
			
		||||
  perl-action  = <<EOP1
 | 
			
		||||
system("logger You have $root_procs root processes running");
 | 
			
		||||
EOP1
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										54
									
								
								samples/sample.ini
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								samples/sample.ini
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,54 @@
 | 
			
		|||
# $Id: sample.ini,v 1.8 2003/03/04 02:53:48 rockyb Exp $
 | 
			
		||||
# Comments start with # or ; and go to the end of the line.
 | 
			
		||||
 | 
			
		||||
# The format for each entry is in Microsoft .INI form:
 | 
			
		||||
# [process-pattern]
 | 
			
		||||
# trigger = perl-expression
 | 
			
		||||
# occurs  = (every|first|none)
 | 
			
		||||
# action  = program-and-arguments-to-run
 | 
			
		||||
 | 
			
		||||
# "trigger" and "occurs" are optional.
 | 
			
		||||
 | 
			
		||||
# Are there enough (at least 4) httpd processes running? 
 | 
			
		||||
[httpd$]
 | 
			
		||||
  trigger = $count < 4
 | 
			
		||||
  action  = echo "$trigger fired -- You have $count $command sessions."
 | 
			
		||||
 | 
			
		||||
# Show how many processes are running. Use builtin $count 
 | 
			
		||||
# variable
 | 
			
		||||
[.]
 | 
			
		||||
  action = echo "You have $count processes running"
 | 
			
		||||
# The below is implied
 | 
			
		||||
#occurs=first
 | 
			
		||||
 | 
			
		||||
# Which processes have been running for more than 1 day?
 | 
			
		||||
# Note this hack to specify a pattern ostensibly different from 
 | 
			
		||||
# the above pattern. This is an IniConf-imposed limitation.
 | 
			
		||||
# Also note use of builtin-function elapsed2secs
 | 
			
		||||
# and builtin constant DAYS.
 | 
			
		||||
# The variable $etime (elapsed time) does not exist on your OS.
 | 
			
		||||
# For on FreeBSD it doesn't, but that has a "cputime" reports a time
 | 
			
		||||
# entry.
 | 
			
		||||
[.?]
 | 
			
		||||
  trigger = elapsed2secs('$etime') > 1*DAYS
 | 
			
		||||
  action  = echo "$command has been running more than 1 day ($etime)"
 | 
			
		||||
  occurs  = every
 | 
			
		||||
 | 
			
		||||
[^]
 | 
			
		||||
  trigger = $vsz > 8000
 | 
			
		||||
  occurs  = every
 | 
			
		||||
  action  = echo "Large program $command (pid $pid) matches /$ps_pat/: $vsz KB"
 | 
			
		||||
 | 
			
		||||
# Scripts don't show as the script name as the command name on some
 | 
			
		||||
# operating systems. Rather the name of the interpreter is listed
 | 
			
		||||
# (e.g. bash or perl) Here's how you can match against a script. Note
 | 
			
		||||
# escaping $ in the trigger but not the action.
 | 
			
		||||
 | 
			
		||||
# Note: BSD/OS on the other hand give the script name rather than the
 | 
			
		||||
# interpreter name.
 | 
			
		||||
 | 
			
		||||
[/usr/bin/perl]
 | 
			
		||||
  trigger = \$args !~ /ps-watcher/
 | 
			
		||||
  occurs  = every
 | 
			
		||||
  action  = echo "***found perl program ${pid}:\n $args"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								samples/sample2.ini
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								samples/sample2.ini
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
[.]
 | 
			
		||||
  trigger = $pcpu > 10
 | 
			
		||||
  action  = echo "$command using $pcpu% CPU" | /bin/mail root
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								samples/solaris.ini
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								samples/solaris.ini
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
# $Id: solaris.ini,v 1.3 2000/04/09 20:40:21 rocky Exp $
 | 
			
		||||
# Processes one might want to monitor under Solaris
 | 
			
		||||
 | 
			
		||||
[(/usr/sbin/)?cron]
 | 
			
		||||
  trigger = $count=1  
 | 
			
		||||
  action  = echo "$command not running" | /usr/ucb/mail -s "$command down" root
 | 
			
		||||
 | 
			
		||||
[(/usr/sbin/)?sylogd]
 | 
			
		||||
  trigger = $count=1  
 | 
			
		||||
  action  = echo "$command not running" | /usr/ucb/mail -s "$command down" root
 | 
			
		||||
 | 
			
		||||
[.]
 | 
			
		||||
  trigger = $pcpu > 70
 | 
			
		||||
  occurs  = every
 | 
			
		||||
  action  = <<EOT
 | 
			
		||||
   echo "$command used $pcpu% CPU" | /usr/ucb/mail -s "$command was a hog" root
 | 
			
		||||
   kill -TERM $pid
 | 
			
		||||
EOT
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue