1
2
3
4
5
6
7
8
9
Database Name DB Size MB DB Free Space MB DB Full% Log Size MB Free Log MB Log Full%
-------------------- ---------- ---------------- -------- ----------- ----------- ---------
master 248 214 13.4 NULL 214 NULL
tempdb 1048 1043 0.4 NULL 1019 NULL
model 24 10 55.9 NULL 10 NULL
XX1 561152 349734 35.3 20480 20399 0.4
sybsystemdb 48 34 29.2 NULL 34 NULL
sybsystemprocs 200 70 64.5 NULL 70 NULL
sybmgmtdb 148 97 34.1 NULL 97 NULL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#! /usr/bin/perl use strict; use warnings; my $filename = "sqldaten.txt"; my $wanted_db = "XX1"; my $free_space_threshold = 12; my $db_full_percent_threshold = 90; open my $rh, '<', $filename or die "Error: open($filename) failed: $!"; while ( my $line = <$rh> ) { my ( $dbname, $free_space, $db_full_percent ) = ( split m{\s+}, $line )[0,2,3]; next if $dbname ne $wanted_db; if ( $free_space < $free_space_threshold ) { printf "%s running out of space: %s MB left\n", $dbname, $free_space; } if ( $db_full_percent > $db_full_percent_threshold ) { printf "%s running full: %s %% filled.\n", $dbname, $db_full_percent; } } close $rh;
my ($dbname, $freeSpaceMB, $dbFullPercent) = (split /\s+/, $zeile)[0,2,3];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/ksh
set -x
SID=XX1;
max=30;
SQL_FILE=/home/user/input_file.txt;
check="$(grep $SID $SQL_FILE| awk '{print $3}')";
echo "$check"
if [ $check -gt $max ]
then
echo " ALARM";
fi