3 changed files
kubernetes | ||
kubernetes_secret_to_external_secret_gcp.sh | ||
kubernetes_secret_to_sealed_secret.sh | ||
kubernetes_secrets_to_sealed_secrets.sh | ||
kubernetes_secret_to_external_secret_gcp.sh
/kubernetes/kubernetes_secret_to_external_secret_gcp.sh+113/kubernetes/kubernetes_secret_to_external_secret_gcp.sh
Add comment 1 Plus #!/usr/bin/perl -T
Add comment 2 Plus # nagios: -epn
Add comment 3 Plus #
Add comment 4 Plus # Author: Hari Sekhon
Add comment 5 Plus # Date: 2014-02-19 22:00:59 +0000 (Wed, 19 Feb 2014)
Add comment 6 Plus #
Add comment 7 Plus # https://github.com/harisekhon/nagios-plugins
Add comment 8 Plus #
Add comment 9 Plus # License: see accompanying Hari Sekhon LICENSE file
Add comment 10 Plus #
Add comment 11 Plus # vim:ts=4:sts=4:sw=4:et
Add comment 12 Plus
Add comment 13 Plus $DESCRIPTION = "Nagios Plugin to check MapR node heartbeats to CLDB via the MapR Control System REST API
Add comment 14 Plus
Add comment 15 Plus By defaults checks all nodes for heartbeat age > 3 (--heartbeat-max). Can restrict by --cluster.
Add comment 16 Plus
Add comment 17 Plus Alternatively check a single --node heartbeat age against the warning/critical thresholds.
Add comment 18 Plus
Add comment 19 Plus Tested on MapR 3.1.0 and 4.0.1";
Add comment 20 Plus
Add comment 21 Plus $VERSION = "0.1";
Add comment 22 Plus
Add comment 23 Plus use strict;
Add comment 24 Plus use warnings;
Add comment 25 Plus BEGIN {
Add comment 26 Plus use File::Basename;
Add comment 27 Plus use lib dirname(__FILE__) . "/lib";
Add comment 28 Plus }
Add comment 29 Plus use HariSekhonUtils qw/:DEFAULT :regex/;
Add comment 30 Plus use HariSekhon::MapR;
Add comment 31 Plus
Add comment 32 Plus $ua->agent("Hari Sekhon $progname version $main::VERSION");
Add comment 33 Plus
Add comment 34 Plus set_threshold_defaults(0, 1);
Add comment 35 Plus
Add comment 36 Plus my $heartbeat_max_default = 3;
Add comment 37 Plus my $heartbeat_max = $heartbeat_max_default;
Add comment 38 Plus
Add comment 39 Plus %options = (
Add comment 40 Plus %mapr_options,
Add comment 41 Plus %mapr_option_cluster,
Add comment 42 Plus %mapr_option_node,
Add comment 43 Plus "heartbeat-max=s" => [ \$heartbeat_max, "Hearbeat threshold in secs for all nodes when not specifying --nodes (default: $heartbeat_max_default). Warning/Critical thresholds apply to the number of failing nodes in this case" ],
Add comment 44 Plus %thresholdoptions,
Add comment 45 Plus );
Add comment 46 Plus splice @usage_order, 6, 0, qw/cluster node heartbeat-max list-clusters list-nodes/;
Add comment 47 Plus
Add comment 48 Plus get_options();
Add comment 49 Plus
Add comment 50 Plus validate_mapr_options();
Add comment 51 Plus list_clusters();
Add comment 52 Plus list_nodes();
Add comment 53 Plus $cluster = validate_cluster $cluster if $cluster;
Add comment 54 Plus $node = validate_host($node, "node") if $node;
Add comment 55 Plus validate_float($heartbeat_max, "heartbeat max", 0, 100);
Add comment 56 Plus validate_thresholds(1, 1, { "simple" => "upper", "integer" => 1, "positive" => 1});
Add comment 57 Plus
Add comment 58 Plus vlog2;
Add comment 59 Plus set_timeout();
Add comment 60 Plus
Add comment 61 Plus $status = "OK";
Add comment 62 Plus
Add comment 63 Plus my $url = "/node/list?columns=fs-heartbeat";
Add comment 64 Plus $url .= "&cluster=$cluster" if $cluster;
Add comment 65 Plus
Add comment 66 Plus $json = curl_mapr $url, $user, $password;
Add comment 67 Plus
Add comment 68 Plus my @data = get_field_array("data");
Add comment 69 Plus
Add comment 70 Plus quit "UNKNOWN", "no node data returned, did you specify the correct --cluster? See --list-clusters" unless @data;
Add comment 71 Plus
Add comment 72 Plus my %fs_heartbeat;
Add comment 73 Plus my $hostname;
Add comment 74 Plus foreach my $node_item (@data){
Add comment 75 Plus $hostname = get_field2($node_item, "hostname");
Add comment 76 Plus if($node){
Add comment 77 Plus if($hostname =~ /^$node(?:\.$domain_regex)?$/){
Add comment 78 Plus $fs_heartbeat{$node} = get_field2_float($node_item, "fs-heartbeat");
Add comment 79 Plus }
Add comment 80 Plus } else {
Add comment 81 Plus $fs_heartbeat{$hostname} = get_field2_float($node_item, "fs-heartbeat");
Add comment 82 Plus }
Add comment 83 Plus }
Add comment 84 Plus if($node){
Add comment 85 Plus unless(%fs_heartbeat and defined($fs_heartbeat{$node})){
Add comment 86 Plus quit "UNKNOWN", "node '$node' heartbeat not found. Did you specify the correct node --node? See --list-nodes";
Add comment 87 Plus }
Add comment 88 Plus $msg .= "node '$node' heartbeat last detected $fs_heartbeat{$node} secs ago";
Add comment 89 Plus check_thresholds($fs_heartbeat{$node});
Add comment 90 Plus $msg .= " | heartbeat_age=$fs_heartbeat{$node}s";
Add comment 91 Plus msg_perf_thresholds();
Add comment 92 Plus } else {
Add comment 93 Plus unless(%fs_heartbeat){
Add comment 94 Plus quit "UNKNOWN", "no nodes heartbeats found. $nagios_plugins_support_msg_api";
Add comment 95 Plus }
Add comment 96 Plus my $bad_heartbeats = 0;
Add comment 97 Plus my $node_count = get_field("total");
Add comment 98 Plus foreach(sort keys %fs_heartbeat){
Add comment 99 Plus $bad_heartbeats++ if $fs_heartbeat{$_} > $heartbeat_max;
Add comment 100 Plus }
Add comment 101 Plus plural $bad_heartbeats;
Add comment 102 Plus $msg .= "$bad_heartbeats node$plural with heartbeats > $heartbeat_max secs";
Add comment 103 Plus check_thresholds($bad_heartbeats);
Add comment 104 Plus plural $node_count;
Add comment 105 Plus $msg .= " out of $node_count node$plural";
Add comment 106 Plus $msg .= " in cluster '$cluster'" if $cluster;
Add comment 107 Plus $msg .= " | 'num nodes with heartbeats > $heartbeat_max secs'=$bad_heartbeats";
Add comment 108 Plus msg_perf_thresholds();
Add comment 109 Plus }
Add comment 110 Plus
Add comment 111 Plus vlog2;
Add comment 112 Plus quit $status, $msg;
Add comment 113 Plus
kubernetes_secret_to_sealed_secret.sh
/kubernetes/kubernetes_secret_to_sealed_secret.sh+113/kubernetes/kubernetes_secret_to_sealed_secret.sh
Add comment 1 Plus #!/usr/bin/perl -T
Add comment 2 Plus # nagios: -epn
Add comment 3 Plus #
Add comment 4 Plus # Author: Hari Sekhon
Add comment 5 Plus # Date: 2014-02-19 22:00:59 +0000 (Wed, 19 Feb 2014)
Add comment 6 Plus #
Add comment 7 Plus # https://github.com/harisekhon/nagios-plugins
Add comment 8 Plus #
Add comment 9 Plus # License: see accompanying Hari Sekhon LICENSE file
Add comment 10 Plus #
Add comment 11 Plus # vim:ts=4:sts=4:sw=4:et
Add comment 12 Plus
Add comment 13 Plus $DESCRIPTION = "Nagios Plugin to check MapR node heartbeats to CLDB via the MapR Control System REST API
Add comment 14 Plus
Add comment 15 Plus By defaults checks all nodes for heartbeat age > 3 (--heartbeat-max). Can restrict by --cluster.
Add comment 16 Plus
Add comment 17 Plus Alternatively check a single --node heartbeat age against the warning/critical thresholds.
Add comment 18 Plus
Add comment 19 Plus Tested on MapR 3.1.0 and 4.0.1";
Add comment 20 Plus
Add comment 21 Plus $VERSION = "0.1";
Add comment 22 Plus
Add comment 23 Plus use strict;
Add comment 24 Plus use warnings;
Add comment 25 Plus BEGIN {
Add comment 26 Plus use File::Basename;
Add comment 27 Plus use lib dirname(__FILE__) . "/lib";
Add comment 28 Plus }
Add comment 29 Plus use HariSekhonUtils qw/:DEFAULT :regex/;
Add comment 30 Plus use HariSekhon::MapR;
Add comment 31 Plus
Add comment 32 Plus $ua->agent("Hari Sekhon $progname version $main::VERSION");
Add comment 33 Plus
Add comment 34 Plus set_threshold_defaults(0, 1);
Add comment 35 Plus
Add comment 36 Plus my $heartbeat_max_default = 3;
Add comment 37 Plus my $heartbeat_max = $heartbeat_max_default;
Add comment 38 Plus
Add comment 39 Plus %options = (
Add comment 40 Plus %mapr_options,
Add comment 41 Plus %mapr_option_cluster,
Add comment 42 Plus %mapr_option_node,
Add comment 43 Plus "heartbeat-max=s" => [ \$heartbeat_max, "Hearbeat threshold in secs for all nodes when not specifying --nodes (default: $heartbeat_max_default). Warning/Critical thresholds apply to the number of failing nodes in this case" ],
Add comment 44 Plus %thresholdoptions,
Add comment 45 Plus );
Add comment 46 Plus splice @usage_order, 6, 0, qw/cluster node heartbeat-max list-clusters list-nodes/;
Add comment 47 Plus
Add comment 48 Plus get_options();
Add comment 49 Plus
Add comment 50 Plus validate_mapr_options();
Add comment 51 Plus list_clusters();
Add comment 52 Plus list_nodes();
Add comment 53 Plus $cluster = validate_cluster $cluster if $cluster;
Add comment 54 Plus $node = validate_host($node, "node") if $node;
Add comment 55 Plus validate_float($heartbeat_max, "heartbeat max", 0, 100);
Add comment 56 Plus validate_thresholds(1, 1, { "simple" => "upper", "integer" => 1, "positive" => 1});
Add comment 57 Plus
Add comment 58 Plus vlog2;
Add comment 59 Plus set_timeout();
Add comment 60 Plus
Add comment 61 Plus $status = "OK";
Add comment 62 Plus
Add comment 63 Plus my $url = "/node/list?columns=fs-heartbeat";
Add comment 64 Plus $url .= "&cluster=$cluster" if $cluster;
Add comment 65 Plus
Add comment 66 Plus $json = curl_mapr $url, $user, $password;
Add comment 67 Plus
Add comment 68 Plus my @data = get_field_array("data");
Add comment 69 Plus
Add comment 70 Plus quit "UNKNOWN", "no node data returned, did you specify the correct --cluster? See --list-clusters" unless @data;
Add comment 71 Plus
Add comment 72 Plus my %fs_heartbeat;
Add comment 73 Plus my $hostname;
Add comment 74 Plus foreach my $node_item (@data){
Add comment 75 Plus $hostname = get_field2($node_item, "hostname");
Add comment 76 Plus if($node){
Add comment 77 Plus if($hostname =~ /^$node(?:\.$domain_regex)?$/){
Add comment 78 Plus $fs_heartbeat{$node} = get_field2_float($node_item, "fs-heartbeat");
Add comment 79 Plus }
Add comment 80 Plus } else {
Add comment 81 Plus $fs_heartbeat{$hostname} = get_field2_float($node_item, "fs-heartbeat");
Add comment 82 Plus }
Add comment 83 Plus }
Add comment 84 Plus if($node){
Add comment 85 Plus unless(%fs_heartbeat and defined($fs_heartbeat{$node})){
Add comment 86 Plus quit "UNKNOWN", "node '$node' heartbeat not found. Did you specify the correct node --node? See --list-nodes";
Add comment 87 Plus }
Add comment 88 Plus $msg .= "node '$node' heartbeat last detected $fs_heartbeat{$node} secs ago";
Add comment 89 Plus check_thresholds($fs_heartbeat{$node});
Add comment 90 Plus $msg .= " | heartbeat_age=$fs_heartbeat{$node}s";
Add comment 91 Plus msg_perf_thresholds();
Add comment 92 Plus } else {
Add comment 93 Plus unless(%fs_heartbeat){
Add comment 94 Plus quit "UNKNOWN", "no nodes heartbeats found. $nagios_plugins_support_msg_api";
Add comment 95 Plus }
Add comment 96 Plus my $bad_heartbeats = 0;
Add comment 97 Plus my $node_count = get_field("total");
Add comment 98 Plus foreach(sort keys %fs_heartbeat){
Add comment 99 Plus $bad_heartbeats++ if $fs_heartbeat{$_} > $heartbeat_max;
Add comment 100 Plus }
Add comment 101 Plus plural $bad_heartbeats;
Add comment 102 Plus $msg .= "$bad_heartbeats node$plural with heartbeats > $heartbeat_max secs";
Add comment 103 Plus check_thresholds($bad_heartbeats);
Add comment 104 Plus plural $node_count;
Add comment 105 Plus $msg .= " out of $node_count node$plural";
Add comment 106 Plus $msg .= " in cluster '$cluster'" if $cluster;
Add comment 107 Plus $msg .= " | 'num nodes with heartbeats > $heartbeat_max secs'=$bad_heartbeats";
Add comment 108 Plus msg_perf_thresholds();
Add comment 109 Plus }
Add comment 110 Plus
Add comment 111 Plus vlog2;
Add comment 112 Plus quit $status, $msg;
Add comment 113 Plus
kubernetes_secrets_to_sealed_secrets.sh
/kubernetes/kubernetes_secrets_to_sealed_secrets.sh+113/kubernetes/kubernetes_secrets_to_sealed_secrets.sh
Add comment 1 Plus #!/usr/bin/perl -T
Add comment 2 Plus # nagios: -epn
Add comment 3 Plus #
Add comment 4 Plus # Author: Hari Sekhon
Add comment 5 Plus # Date: 2014-02-19 22:00:59 +0000 (Wed, 19 Feb 2014)
Add comment 6 Plus #
Add comment 7 Plus # https://github.com/harisekhon/nagios-plugins
Add comment 8 Plus #
Add comment 9 Plus # License: see accompanying Hari Sekhon LICENSE file
Add comment 10 Plus #
Add comment 11 Plus # vim:ts=4:sts=4:sw=4:et
Add comment 12 Plus
Add comment 13 Plus $DESCRIPTION = "Nagios Plugin to check MapR node heartbeats to CLDB via the MapR Control System REST API
Add comment 14 Plus
Add comment 15 Plus By defaults checks all nodes for heartbeat age > 3 (--heartbeat-max). Can restrict by --cluster.
Add comment 16 Plus
Add comment 17 Plus Alternatively check a single --node heartbeat age against the warning/critical thresholds.
Add comment 18 Plus
Add comment 19 Plus Tested on MapR 3.1.0 and 4.0.1";
Add comment 20 Plus
Add comment 21 Plus $VERSION = "0.1";
Add comment 22 Plus
Add comment 23 Plus use strict;
Add comment 24 Plus use warnings;
Add comment 25 Plus BEGIN {
Add comment 26 Plus use File::Basename;
Add comment 27 Plus use lib dirname(__FILE__) . "/lib";
Add comment 28 Plus }
Add comment 29 Plus use HariSekhonUtils qw/:DEFAULT :regex/;
Add comment 30 Plus use HariSekhon::MapR;
Add comment 31 Plus
Add comment 32 Plus $ua->agent("Hari Sekhon $progname version $main::VERSION");
Add comment 33 Plus
Add comment 34 Plus set_threshold_defaults(0, 1);
Add comment 35 Plus
Add comment 36 Plus my $heartbeat_max_default = 3;
Add comment 37 Plus my $heartbeat_max = $heartbeat_max_default;
Add comment 38 Plus
Add comment 39 Plus %options = (
Add comment 40 Plus %mapr_options,
Add comment 41 Plus %mapr_option_cluster,
Add comment 42 Plus %mapr_option_node,
Add comment 43 Plus "heartbeat-max=s" => [ \$heartbeat_max, "Hearbeat threshold in secs for all nodes when not specifying --nodes (default: $heartbeat_max_default). Warning/Critical thresholds apply to the number of failing nodes in this case" ],
Add comment 44 Plus %thresholdoptions,
Add comment 45 Plus );
Add comment 46 Plus splice @usage_order, 6, 0, qw/cluster node heartbeat-max list-clusters list-nodes/;
Add comment 47 Plus
Add comment 48 Plus get_options();
Add comment 49 Plus
Add comment 50 Plus validate_mapr_options();
Add comment 51 Plus list_clusters();
Add comment 52 Plus list_nodes();
Add comment 53 Plus $cluster = validate_cluster $cluster if $cluster;
Add comment 54 Plus $node = validate_host($node, "node") if $node;
Add comment 55 Plus validate_float($heartbeat_max, "heartbeat max", 0, 100);
Add comment 56 Plus validate_thresholds(1, 1, { "simple" => "upper", "integer" => 1, "positive" => 1});
Add comment 57 Plus
Add comment 58 Plus vlog2;
Add comment 59 Plus set_timeout();
Add comment 60 Plus
Add comment 61 Plus $status = "OK";
Add comment 62 Plus
Add comment 63 Plus my $url = "/node/list?columns=fs-heartbeat";
Add comment 64 Plus $url .= "&cluster=$cluster" if $cluster;
Add comment 65 Plus
Add comment 66 Plus $json = curl_mapr $url, $user, $password;
Add comment 67 Plus
Add comment 68 Plus my @data = get_field_array("data");
Add comment 69 Plus
Add comment 70 Plus quit "UNKNOWN", "no node data returned, did you specify the correct --cluster? See --list-clusters" unless @data;
Add comment 71 Plus
Add comment 72 Plus my %fs_heartbeat;
Add comment 73 Plus my $hostname;
Add comment 74 Plus foreach my $node_item (@data){
Add comment 75 Plus $hostname = get_field2($node_item, "hostname");
Add comment 76 Plus if($node){
Add comment 77 Plus if($hostname =~ /^$node(?:\.$domain_regex)?$/){
Add comment 78 Plus $fs_heartbeat{$node} = get_field2_float($node_item, "fs-heartbeat");
Add comment 79 Plus }
Add comment 80 Plus } else {
Add comment 81 Plus $fs_heartbeat{$hostname} = get_field2_float($node_item, "fs-heartbeat");
Add comment 82 Plus }
Add comment 83 Plus }
Add comment 84 Plus if($node){
Add comment 85 Plus unless(%fs_heartbeat and defined($fs_heartbeat{$node})){
Add comment 86 Plus quit "UNKNOWN", "node '$node' heartbeat not found. Did you specify the correct node --node? See --list-nodes";
Add comment 87 Plus }
Add comment 88 Plus $msg .= "node '$node' heartbeat last detected $fs_heartbeat{$node} secs ago";
Add comment 89 Plus check_thresholds($fs_heartbeat{$node});
Add comment 90 Plus $msg .= " | heartbeat_age=$fs_heartbeat{$node}s";
Add comment 91 Plus msg_perf_thresholds();
Add comment 92 Plus } else {
Add comment 93 Plus unless(%fs_heartbeat){
Add comment 94 Plus quit "UNKNOWN", "no nodes heartbeats found. $nagios_plugins_support_msg_api";
Add comment 95 Plus }
Add comment 96 Plus my $bad_heartbeats = 0;
Add comment 97 Plus my $node_count = get_field("total");
Add comment 98 Plus foreach(sort keys %fs_heartbeat){
Add comment 99 Plus $bad_heartbeats++ if $fs_heartbeat{$_} > $heartbeat_max;
Add comment 100 Plus }
Add comment 101 Plus plural $bad_heartbeats;
Add comment 102 Plus $msg .= "$bad_heartbeats node$plural with heartbeats > $heartbeat_max secs";
Add comment 103 Plus check_thresholds($bad_heartbeats);
Add comment 104 Plus plural $node_count;
Add comment 105 Plus $msg .= " out of $node_count node$plural";
Add comment 106 Plus $msg .= " in cluster '$cluster'" if $cluster;
Add comment 107 Plus $msg .= " | 'num nodes with heartbeats > $heartbeat_max secs'=$bad_heartbeats";
Add comment 108 Plus msg_perf_thresholds();
Add comment 109 Plus }
Add comment 110 Plus
Add comment 111 Plus vlog2;
Add comment 112 Plus quit $status, $msg;
Add comment 113 Plus