/[mon-modules]/sap.monitor
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /sap.monitor

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Tue Jul 9 14:06:45 2002 UTC (21 years, 8 months ago) by dpavlin
Branch: MAIN
Branch point for: DbP
Initial revision

1 dpavlin 1.1 #!/usr/bin/perl -w
2    
3     use strict;
4    
5     my @config;
6     open(C,"/usr/local/etc/sap-mon.conf") || die "sap-mon.conf: $!";
7     @config = <C>;
8     close(C);
9    
10     my @failed;
11     my @ok;
12     my $fail_msg = "";
13    
14     # sap info leaves trace files, so create dir without write permission
15     # and chdir to it!
16     mkdir "/tmp/sap$$",0555 || die "can't make /tmp/sap$$: $!";
17     chdir "/tmp/sap$$" || die "can't chdir in /tmp/sap$$: $!";
18    
19     foreach (@config) {
20     chomp;
21     s/#.+$//g; # nuke comments
22     s/^\s+$//g; # remove empty lines
23     my ($ashost,$sysnr) = split(/\t+/,$_,2);
24     if ($ashost && $ashost ne "" && $sysnr && $sysnr ne "") {
25     my $output = `/usr/local/bin/sapinfo trace=0 ashost=$ashost sysnr=$sysnr`;
26     $output =~ m/System ID\s+(\w+)/;
27     my $sys_id = $1 || "";
28     if ($? != 0) {
29     push @failed, "$ashost ($sysnr)";
30     $fail_msg .= $output;
31     } else {
32     push @ok, "$ashost ($sys_id)";
33     }
34     }
35     }
36    
37     my $exit = 0;
38    
39     if (@failed) {
40     print "FAILED HOSTS: ",join(", ",@failed),"\n\n";
41     print "$fail_msg\n";
42     $exit = 1;
43     }
44    
45     print "CHECKED HOSTS (which are OK): ",join(", ",@ok),"\n\n";
46    
47     rmdir "/tmp/sap$$" || die "can't rmdir in /tmp/sap$$: $!";
48    
49     exit $exit;

  ViewVC Help
Powered by ViewVC 1.1.26