GRAYBYTE WORDPRESS FILE MANAGER2359

Server IP : 149.255.58.128 / Your IP : 216.73.216.64
System : Linux cloud516.thundercloud.uk 5.14.0-427.26.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 17 15:51:13 EDT 2024 x86_64
PHP Version : 8.2.28
Disable Function : allow_url_include, apache_child_terminate, apache_setenv, exec, passthru, pcntl_exec, posix_kill, posix_mkfifo, posix_getpwuid, posix_setpgid, posix_setsid, posix_setuid, posix_setgid, posix_seteuid, posix_setegid, posix_uname, proc_close, proc_get_status, proc_open, proc_terminate, shell_exec, show_source, system
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /lib64/nagios/plugins/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /lib64/nagios/plugins//check_crm.pl
#!/usr/bin/perl
#
# check_crm_v0_7
#
# Copyright © 2013 Philip Garner, Sysnix Consultants Limited
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Authors: Phil Garner - phil@sysnix.com & Peter Mottram - peter@sysnix.com
#
# v0.1 09/01/2011
# v0.2 11/01/2011
# v0.3 22/08/2011 - bug fix and changes suggested by Vadym Chepkov
# v0.4 23/08/2011 - update for spelling and anchor regex capture (Vadym Chepkov)
# v0.5 29/09/2011 - Add standby warn/crit suggested by Sönke Martens & removal
#                   of 'our' to 'my' to completely avoid problems with ePN
# v0.6 14/03/2013 - Change from \w+ to \S+ in stopped check to cope with
#                   Servers that have non word charachters in.  Suggested by
#                   Igal Baevsky.
# v0.7 01/09/2013 - In testing as still not fully tested.  Adds optional 
#		    constraints check (Boris Wesslowski). Adds fail count 
#		    threshold ( Zoran Bosnjak & Marko Hrastovec )
#
# NOTES: Requires Perl 5.8 or higher & the Perl Module Nagios::Plugin
#        Nagios user will need sudo acces - suggest adding line below to
#        sudoers
#	     nagios  ALL=(ALL) NOPASSWD: /usr/sbin/crm_mon -1 -r -f
#
#		if you want to check for location constraints (-c) also add
#	     nagios  ALL=(ALL) NOPASSWD: /usr/sbin/crm configure show
#
#	     In sudoers if requiretty is on (off state is default)
#	     you will also need to add the line below
#	     Defaults:nagios !requiretty
#

use warnings;
use strict;
use Nagios::Plugin;

# Lines below may need changing if crm_mon or sudo installed in a
# different location.

my $sudo               = '/usr/bin/sudo';
my $crm_mon            = '/usr/sbin/crm_mon -1 -r -f';
my $crm_configure_show = '/usr/sbin/crm configure show';

my $np = Nagios::Plugin->new(
    shortname => 'check_crm',
    version   => '0.7',
    usage     => "Usage: %s <ARGS>\n\t\t--help for help\n",
);

$np->add_arg(
    spec => 'warning|w',
    help =>
'If failed Nodes, stopped Resources detected or Standby Nodes sends Warning instead of Critical (default) as long as there are no other errors and there is Quorum',
    required => 0,
);

$np->add_arg(
    spec     => 'standbyignore|s',
    help     => 'Ignore any node(s) in standby, by default sends Critical',
    required => 0,
);

$np->add_arg(
    spec => 'constraint|constraints|c',
    help => 'Also check configuration for location constraints (caused by migrations) and warn if there are any.  Requires additional privileges see notes',
    required => 0,
);

$np->add_arg(
    spec     => 'failcount|failcounts|f=i',
    help     => 'resource fail count to start warning on [default = 1].',
    required => 0,
    default  => 1,
);

$np->getopts;
my $ConstraintsFlag = $np->opts->constraint;

my @standby;

# Check for -w option set warn if this is case instead of crit
my $warn_or_crit = 'CRITICAL';
$warn_or_crit = 'WARNING' if $np->opts->warning;

my $fh;

open( $fh, "$sudo $crm_mon |" )
  or $np->nagios_exit( CRITICAL, "Running $sudo $crm_mon has failed" );

foreach my $line (<$fh>) {

    if ( $line =~ m/Connection to cluster failed\:(.*)/i ) {

        # Check Cluster connected
        $np->nagios_exit( CRITICAL, "Connection to cluster FAILED: $1" );
    }
    elsif ( $line =~ m/Current DC:/ ) {

        # Check for Quorum
        if ( $line =~ m/partition with quorum$/ ) {

            # Assume cluster is OK - we only add warn/crit after here

            $np->add_message( OK, "Cluster OK" );
        }
        else {
            $np->add_message( CRITICAL, "No Quorum" );
        }
    }
    elsif ( $line =~ m/^offline:\s*\[\s*(\S.*?)\s*\]/i ) {

        # Count offline nodes
        my @offline = split( /\s+/, $1 );
        my $numoffline = scalar @offline;
        $np->add_message( $warn_or_crit, ": $numoffline Nodes Offline" );
    }
    elsif ( $line =~ m/^node\s+(\S.*):\s*standby/i ) {

        # Check for standby nodes (suggested by Sönke Martens)
        # See later in code for message created from this
        push @standby, $1;
    }

    elsif ( $line =~ m/\s*(\S+)\s+\(\S+\)\:\s+Stopped/ ) {

        # Check Resources Stopped
        $np->add_message( $warn_or_crit, ": $1 Stopped" );
    }
    elsif ( $line =~ m/\s*stopped\:\s*\[(.*)\]/i ) {

        # Check Master/Slave stopped
        $np->add_message( $warn_or_crit, ": $1 Stopped" );
    }
    elsif ( $line =~ m/^Failed actions\:/ ) {

        # Check Failed Actions
        $np->add_message( CRITICAL,
            ": FAILED actions detected or not cleaned up" );
    }
    elsif ( $line =~ m/\s*(\S+?)\s+ \(.*\)\:\s+\w+\s+\w+\s+\(unmanaged\)\s+/i )
    {

        # Check Unmanaged
        $np->add_message( CRITICAL, ": $1 unmanaged FAILED" );
    }
    elsif ( $line =~ m/\s*(\S+?)\s+ \(.*\)\:\s+not installed/i ) {

        # Check for errors
        $np->add_message( CRITICAL, ": $1 not installed" );
    }
    elsif ( $line =~ m/\s*(\S+?):.*fail-count=(\d+)/i ) {
        if ( $2 >= $np->opts->failcount ) {

            # Check for resource Fail count (suggested by Vadym Chepkov)
            $np->add_message( WARNING, ": $1 failure detected, fail-count=$2" );
        }
    }
}

# If found any Nodes in standby & no -s option used send warn/crit
if ( scalar @standby > 0 && !$np->opts->standbyignore ) {
    $np->add_message( $warn_or_crit,
        ": " . join( ', ', @standby ) . " in Standby" );
}

close($fh) or $np->nagios_exit( CRITICAL, "Running $crm_mon FAILED" );

# if -c flag set check configuration for constraints
if ($ConstraintsFlag) {

    open( $fh, "$sudo $crm_configure_show|" )
      or $np->nagios_exit( CRITICAL,
        "Running $sudo $crm_configure_show has failed" );

    foreach my $line (<$fh>) {
        if ( $line =~ m/location cli-(prefer|standby)-\S+\s+(\S+)/ ) {
            $np->add_message( WARNING,
                ": $2 blocking location constraint detected" );
        }
    }
    close($fh)
      or $np->nagios_exit( CRITICAL, "Running $crm_configure_show FAILED" );
}

$np->nagios_exit( $np->check_messages() );


[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
April 28 2024 11:20:59
0 / root
0755
eventhandlers
--
April 28 2024 11:20:59
0 / root
0755
check_apache2.sh
10.779 KB
January 30 2013 12:21:10
0 / root
0755
check_cpu.sh
4.36 KB
February 12 2019 08:36:33
0 / root
0755
check_crm.pl
6.467 KB
September 17 2015 13:45:51
0 / root
0755
check_disk
53.047 KB
March 28 2024 13:15:48
0 / root
0755
check_iface.php
5.883 KB
September 29 2015 14:20:25
0 / root
0755
check_jetbackup
7.843 KB
July 29 2024 11:13:24
0 / root
0755
check_load
35.703 KB
March 28 2024 13:15:48
0 / root
0755
check_mem.pl
6.235 KB
January 28 2013 15:36:20
0 / root
0755
check_mpt.sh
2.267 KB
February 18 2015 18:15:28
0 / root
0755
check_mqueue_exiqgrep.sh
0.97 KB
February 27 2023 18:26:09
0 / root
0755
check_mqueue_postfix.sh
1.082 KB
February 13 2019 10:23:20
0 / root
0755
check_mysql.pl
27.219 KB
January 30 2013 13:09:36
0 / root
0755
check_mysql_replication.sh
2.065 KB
May 20 2010 10:29:33
0 / root
0755
check_raid.pl
114.584 KB
November 20 2015 12:37:21
0 / root
0755
check_service.sh
10.078 KB
October 30 2024 17:54:56
0 / root
0755
check_swap
31.719 KB
March 28 2024 13:15:48
0 / root
0755
error_log
0.551 KB
May 03 2024 08:18:25
0 / root
0644
negate
27.617 KB
March 28 2024 13:15:48
0 / root
0755
urlize
23.359 KB
March 28 2024 13:15:48
0 / root
0755
utils.sh
2.729 KB
March 28 2024 13:15:40
0 / root
0755

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF