Skip to content

Commit

Permalink
Merge pull request #75 from cweiland/patch-1
Browse files Browse the repository at this point in the history
Typo mistakes
  • Loading branch information
oscar120584 authored May 6, 2022
2 parents df8d311 + a66ad8f commit 4f2b5b5
Showing 1 changed file with 15 additions and 64 deletions.
79 changes: 15 additions & 64 deletions Applications/Cluster/template_corosync_status/6.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,87 +39,38 @@ UserParameter=check\_corosync[*], /etc/zabbix/scripts/corosync.pl $1




```
#!/usr/bin/perl




my $sudo = '/usr/bin/sudo';


my $cfgtool = '/usr/sbin/corosync-cfgtool -s';




$num\_args = $#ARGV + 1;


if ($num\_args != 1) {
$num_args = $#ARGV + 1;
if ($num_args != 1) {
print "\nUsage: corosync.pl ring number\n";


exit;


}

my $ringNumber = $ARGV[0];


open( $fh, "$cfgtool |" ) or die ( "Running corosync-cfgtool failed" );


open( $fh, "$sudo $cfgtool |" ) or die ( "Running corosync-cfgtool failed" );
foreach my $line (<$fh>) {


if ( $line =~ m/status\s*=\s*(\S.+)/ ) {


my $status = $1;


if ( $status =~ m/^ring $ringNumber/ ) {


# print "RING NUMBER $ringNumber STATUS: $status\n";


if ( $status =~ m/^ring $ringNumber active with no faults/ ) {


print "0";


} else {


print "1";


}


exit;


}


my $status = $1;
if ( $status =~ m/^ring $ringNumber/ ) {
# print "RING NUMBER $ringNumber STATUS: $status\n";
if ( $status =~ m/^ring $ringNumber active with no faults/ ) {
print "0";
} else {
print "1";
}
exit;
}
}


}


close($fh) or die ( "Running corosync-cfgtool failed" );

```



Expand Down

0 comments on commit 4f2b5b5

Please sign in to comment.