Skip to content

Commit a66ad8f

Browse files
authored
Typo mistakes
Look cleaner now
1 parent 2802d82 commit a66ad8f

File tree

1 file changed

+15
-64
lines changed
  • Applications/Cluster/template_corosync_status/6.0

1 file changed

+15
-64
lines changed

Applications/Cluster/template_corosync_status/6.0/README.md

+15-64
Original file line numberDiff line numberDiff line change
@@ -39,87 +39,38 @@ UserParameter=check\_corosync[*], /etc/zabbix/scripts/corosync.pl $1
3939

4040

4141

42-
42+
```
4343
#!/usr/bin/perl
4444
45-
46-
47-
48-
4945
my $sudo = '/usr/bin/sudo';
50-
51-
5246
my $cfgtool = '/usr/sbin/corosync-cfgtool -s';
5347
54-
55-
56-
57-
58-
$num\_args = $#ARGV + 1;
59-
60-
61-
if ($num\_args != 1) {
48+
$num_args = $#ARGV + 1;
6249
6350
51+
if ($num_args != 1) {
6452
print "\nUsage: corosync.pl ring number\n";
65-
66-
6753
exit;
68-
69-
7054
}
7155
72-
7356
my $ringNumber = $ARGV[0];
74-
75-
76-
open( $fh, "$cfgtool |" ) or die ( "Running corosync-cfgtool failed" );
77-
78-
57+
open( $fh, "$sudo $cfgtool |" ) or die ( "Running corosync-cfgtool failed" );
7958
foreach my $line (<$fh>) {
80-
81-
8259
if ( $line =~ m/status\s*=\s*(\S.+)/ ) {
83-
84-
85-
my $status = $1;
86-
87-
88-
if ( $status =~ m/^ring $ringNumber/ ) {
89-
90-
91-
# print "RING NUMBER $ringNumber STATUS: $status\n";
92-
93-
94-
if ( $status =~ m/^ring $ringNumber active with no faults/ ) {
95-
96-
97-
print "0";
98-
99-
100-
} else {
101-
102-
103-
print "1";
104-
105-
106-
}
107-
108-
109-
exit;
110-
111-
112-
}
113-
114-
60+
my $status = $1;
61+
if ( $status =~ m/^ring $ringNumber/ ) {
62+
# print "RING NUMBER $ringNumber STATUS: $status\n";
63+
if ( $status =~ m/^ring $ringNumber active with no faults/ ) {
64+
print "0";
65+
} else {
66+
print "1";
67+
}
68+
exit;
69+
}
11570
}
116-
117-
11871
}
119-
120-
12172
close($fh) or die ( "Running corosync-cfgtool failed" );
122-
73+
```
12374

12475

12576

0 commit comments

Comments
 (0)