Indian River County Sheriff Deryl Loar is calling it quits after 12 years on the job.
In this week’s issue, he talks about his plans for the future.
/home/httpd/html/ |
Current File : /home/httpd/html/mojo_nagios_diskspace_check.php |
<?php $warn=93; ?> <html> <head> <style type='text/css'> body { width: 540px; margin: 30px auto; } .progress { border: 2px solid #26D; height: 32px; width: 540px; margin: 30px auto; } .progress .prgbar { background: #ACF; width: 0%; position: relative; height: 32px; z-index: 999; } .progress .prgtext { color: #238; width: 540px; text-align: center; font-size: 16px; padding: 9px 0 0; position: absolute; z-index: 1000; } .progress .prginfo { margin: 3px 0; } </style> </head> <body bgcolor="#FFFFFF"> <?php $alert=0; exec('mount | grep "ext[234]\|xfs" | cut -d\ -f3 | grep -v "/boot\|/backup"', $filesystems); foreach ($filesystems as $fs) { $df = disk_free_space($fs); $dt = disk_total_space($fs); $du = $dt - $df; $dp = sprintf('%.2f',($du / $dt) * 100); $df = formatSize($df); $du = formatSize($du); $dt = formatSize($dt); if ( $dp >= $warn ) { $alert = $warn; $bg = "#F88"; } else { $bg = "#ACF"; } ?> <div class='progress'> <div class='prgtext'><?php echo "$fs - $dp"; ?>% Disk Used</div> <div class='prgbar' style='width:<?php echo $dp; ?>%;background:<?php echo $bg; ?>'></div> <div class='prginfo'> <span style='float: left;'><?php echo "$du of $dt used"; ?></span> <span style='float: right;'><?php echo "$df of $dt free"; ?></span> <span style='clear: both;'></span> </div> </div> <?php // Calculate Inode usage: $inf = `/bin/df -i $fs | grep $fs | awk '{print $4}'`; $int = `/bin/df -i $fs | grep $fs | awk '{print $2}'`; $inu = $int - $inf; $inp = sprintf('%.2f',($inu / $int) * 100); $inf = formatInodes($inf); $inu = formatInodes($inu); $int = formatInodes($int); if ( $inp >= $warn ) { $alert = $warn; $bg = "#F88"; } else { $bg = "#ACF"; } ?> <div class='progress'> <div class='prgtext'><?php echo "$fs - $inp"; ?>% Inodes Used</div> <div class='prgbar' style='width:<?php echo $inp; ?>%;background:<?php echo $bg; ?>'></div> <div class='prginfo'> <span style='float: left;'><?php echo "$inu of $int used"; ?></span> <span style='float: right;'><?php echo "$inf of $int free"; ?></span> <span style='clear: both;'></span> </div> </div> <hr /> <?php } ?> <?php if ( $alert >= $warn ) { print "WARNING: disk space is low"; } else { print "OK: disk space is below $warn %"; } ?> <?php function formatSize( $bytes ) { $types = array( 'B', 'KB', 'MB', 'GB', 'TB' ); for( $i = 0; $bytes >= 1024 && $i < ( count( $types ) -1 ); $bytes /= 1024, $i++ ); return( round( $bytes, 2 ) . " " . $types[$i] ); } function formatInodes( $inodes ) { $types = array( '', 'K', 'M', 'B', 'T' ); for( $i = 0; $inodes >= 1000 && $i < ( count( $types ) -1 ); $inodes /= 1000, $i++ ); return( round( $inodes, 2 ) . $types[$i] ); } ?> </body>