-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpu_memory.pl
More file actions
78 lines (52 loc) · 1.87 KB
/
cpu_memory.pl
File metadata and controls
78 lines (52 loc) · 1.87 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
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/local/bin/perl
use strict;
chomp(my $server = `hostname`);
$server =~ s/\.amkor\.com//g;
my $color = 'green';
my $machine = "$server,amkor,com";
my $test = 'cm';
my $uname = `uname -a`;
if ( $uname =~ /Linux/ ) {
my $data = `free -g`;
$data =~ /Mem:\s+(\d+)/;
my $memory_size = $1;
$memory_size = "$memory_size".'gb';
$data = `cat /proc/cpuinfo | grep processor | wc`;
$data =~ /\s+(\d+)/;
my $cpu = $1;
my $results = "\n\n";
$results .= "Memory: $memory_size\n";
$results .= "CPU: $cpu\n";
my $line = "status+25h $machine.$test $color $results";
# Send to XYMon
print "$line\n";
system("echo \"$line\" | /usr/local/admin/scripts/hobbit/send_to_hobbit.ksh");
exit;
}
my $data = `prtconf 2> /dev/null`;
$data =~ /Memory size:\s(\d+)\s(\w+)/;
my $memory_size = "$1"." "."$2";
$data = `psrinfo -v`;
$data =~ /The\s(\w+)\sprocessor\soperates\sat\s(\d+)\s(\w+)/;
my $processor_type = "$1"." "."$2"." "."$3";
chomp(my $num_cpus = `psrinfo | wc -l`);
$num_cpus =~ s/\s//g;
chomp(my $physical = `psrinfo -p`);
#$results .= sprintf("\n%-20s %7s %7s \n", "Totals","$ora_total","$sap_total");
my $hw_type_file = "/usr/local/admin/scripts/local_zone_hw_type/$server";
my $hw_type;
if ( -e $hw_type_file ) {
$hw_type = `cat /usr/local/admin/scripts/local_zone_hw_type/$server`;
} else {
$hw_type = "\n";
}
my $results = sprintf("%-20s \n","Hardware Config");
$results .= sprintf("%-20s %-7s \n","Memory Size:","$memory_size");
$results .= sprintf("%-20s %-7s \n","Processor Type:","$processor_type");
$results .= sprintf("%-20s %-7s \n","Number of cpus:","$physical");
$results .= sprintf("%-20s %-7s \n","Number of cores:","$num_cpus");
$results .= "\n\n";
$results .= "$hw_type";
my $line = "status+25h $machine.$test $color $results";
# Send to XYMon
system("echo \"$line\" | /usr/local/admin/scripts/hobbit/send_to_hobbit.ksh");