-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsap_disk.pl
More file actions
63 lines (56 loc) · 2.25 KB
/
sap_disk.pl
File metadata and controls
63 lines (56 loc) · 2.25 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/local/bin/perl -w
use strict;
################################
# #
# bb script sap_disk #
# #
# Check for sap filesystems #
# usage percentage #
# #
# Martin Colello #
# 10/17/2005 #
# #
################################
my $uname = `uname -a`;
if ( $uname =~ /Linux/ ) {
exit;
}
my $data = '';
my $color = 'green';
my $test = 'sap_dsk';
# Get machine name
my $server = `uname -a`;
my @server = split / /, $server;
$server = $server[1];
my $machine = "$server,amkor,com";
# Get list of directories
my @files = `df -k | more`;
# Grep out only sap related mount points
my @ora_dirs;
foreach (@files) {
if (/chaznas03/) { push @ora_dirs, $_ unless /shared/ or /unix_share/ or /unix_data/ or /sapdata_qas /}
if (/chaznas04/) { push @ora_dirs, $_ unless /shared/ or /unix_share/ or /unix_data/ }
if (/chaznas07/) { push @ora_dirs, $_ unless /shared/ or /unix_share/ or /unix_data/ }
if (/chaznas08/) { push @ora_dirs, $_ unless /shared/ or /unix_share/ or /unix_data/ }
if (/chaznas09/) { push @ora_dirs, $_ unless /shared/ or /unix_share/ or /unix_data/ }
if (/chaznas10/) { push @ora_dirs, $_ unless /shared/ or /unix_share/ or /unix_data/ }
if (/chaznas11/) { push @ora_dirs, $_ unless /shared/ or /unix_share/ or /unix_data/ }
}
# Get output of df -k
foreach (@ora_dirs) {
my @dfk = split / /, $_;
my $percent;
foreach(@dfk) {
if (/%/) {
s/%//g;# Remove the % sign
$percent = $_;
if ($percent > 96) {# Test to see if we hit 97.
$color = 'red';# If so, color is red.
}
$data = $data . "$dfk[0] is at $percent percent.\n";# add line to $data
}
}
}#end of foreach(@ora_dirs)
my $date = `date`;
my $line = "status $machine.$test $color $date$data";# set line to deliver to bb
system("echo \"$line\" | /usr/local/admin/scripts/hobbit/send_to_hobbit.ksh");