// 
// Some Common Performance Monitoring Scenarios
//
// The Disk Group
//

delta = 15 sec;		// often enough for disks?

// common prefixes
//
disk	= "disk";

//
// Any disk performing more than 40 I/Os per second, sustained over
// at least 30 seconds is probably busy
//
delta = 30 seconds;
disk_busy =
    some_inst (
	$disk.dev.total > 40 count/sec
    )
    -> shell 15 mins "Mail -s 'Heavy sustained disk traffic' sysadm </dev/null";

// Try and catch bursts of activity ... more than 60 I/Os per second
// for at least 25% of 8 consecutive 3 second samples
//
delta = 3 sec;
disk_burst =
    some_inst (
	25%_sample (
	    $disk.dev.total @0..7 > 60 count/sec
	)
    )
    -> alarm 5 mins "Disk Burst? " "%i ";

// any SCSI disk controller performing more than 3 Mbytes per sec is busy
//
some_inst $disk.ctl.blktotal * 0.5 > 3 Mbyte/sec
    -> alarm "Busy Disk Controller: " "%i ";


//
// A subset of the disks on a particular host are either busy
// (more than 30 I/Os per second averaged over these disks) or one
// disk is busy (more than 50 I/Os per second) with write-dominated
// (more than 75%) activity

delta = 10 sec;

myhost = "moomba";			// the host of interest
mydisks = "#dks1d1 #dks1d2 #dks3d2";	// the disks of interest on this host

metric = "disk.dev";

disk_group_busy =
    (
	avg_inst ( $metric.total :$myhost $mydisks ) > 10 count/sec ||
	some_inst (
	    $metric.total :$myhost $mydisks > 50 count/sec &&
	    $metric.write :$myhost $mydisks >
		3 * $metric.write :$myhost $mydisks
	)
    )
	    -> alarm "Busy disks: $mydisks on host: $myhost)"; 

//
// Assume the / and /usr file systems are on different partitions
// of the same disk (/dev/dsk0d1 in the example below).
// Add an entry to the file $PCP_LOG_DIR/NOTICES when this disk is
// busy and either of the file systems is more than 90% full.
//
// Suggestion from: Steve Daniels (steve@houdini.denver.sgi.com)

delta = 60;

( filesys.full #'/dev/root' > 90 || filesys.full #'/dev/usr' > 90 )
&& disk.dev.total #'dks0d1' > 40 count/sec
    -> shell 15min "/usr/lib/pcp/pcp/bin/pmpost 'dks0d1 busy when / or /usr nearly full'";

