diff --git a/Any/Sudo/zabbix b/Any/Sudo/zabbix index fa7bc19a6e2b21a0f3271de20760118d8c259bc2..bd69e0c674a9c2f70220414b6d44444e04bb7c62 100644 --- a/Any/Sudo/zabbix +++ b/Any/Sudo/zabbix @@ -1,8 +1,8 @@ Defaults:zabbix !requiretty -Cmnd_Alias ZBXCEPH = /usr/bin/ceph health, /usr/bin/ceph osd * +Cmnd_Alias ZBXCEPH = /usr/bin/ceph health Cmnd_Alias ZBXMULTIPATH = /sbin/multipathd, /usr/sbin/multipathd -Cmnd_Alias ZBXCRMCMD = /usr/bin/crm_resource --locate --quiet --resource * +Cmnd_Alias ZBXCRMCMD = /usr/bin/crm_resource --locate --quiet --resource * Cmnd_Alias ZBXHAPROXY = /usr/bin/socat /var/lib/haproxy/stats stdio Cmnd_Alias ZBXIPSTATE = /usr/sbin/iptstate, /usr/sbin/ipstate Cmnd_Alias ZBXPS = /bin/ps, /usr/bin/ps, /sbin/ps, /usr/sbin/ps diff --git a/Linux/Script/count_systemctlTasks.pl b/Linux/Script/count_systemctlTasks.pl index 65282f6bf426e70e3b8a15deafcef78da3f3ccce..a05943fd62adbfe4975acc596435f798a4614a02 100755 --- a/Linux/Script/count_systemctlTasks.pl +++ b/Linux/Script/count_systemctlTasks.pl @@ -11,12 +11,12 @@ # *) number of failed # # Example: -# # Count all services for service matching regex -# count_systemctlTasks.pl -s '^ceph-mon\S+service' -# # Count running services for service matching regex -# count_systemctlTasks.pl -s '^ceph-osd\S+service' -r +# # Count all services for service matching servicename and type +# count_systemctlTasks.pl -s ceph-mon -t service +# # Count running services for service matching servicename and type +# count_systemctlTasks.pl -s ceph-mon -t service -r # # Count all failed services -# count_systemctlTasks.pl -s '^\S+service' -f +# count_systemctlTasks.pl -f # ################################################################################ use strict; @@ -35,13 +35,14 @@ my $_sudo = `which sudo`; chomp $_sudo; ### Options -our($opt_exec, $opt_become, $opt_running, $opt_failed, $opt_filter, $opt_debug, $opt_h); +our($opt_exec, $opt_become, $opt_running, $opt_failed, $opt_filter, $opt_type, $opt_debug, $opt_h); if (@ARGV > 0) { GetOptions("e=s"=>\$opt_exec, "b" =>\$opt_become, "r" =>\$opt_running, "f" =>\$opt_failed, "s=s"=>\$opt_filter, + "t=s"=>\$opt_type, "d" =>\$opt_debug, "h" =>\$opt_h) || fail_usage; } fail_usage "Unknown parameter." if (@ARGV > 0); @@ -63,6 +64,10 @@ my $matchStr = ""; if (defined $opt_filter) { $matchStr = $opt_filter; } +my $matchType = ""; +if (defined $opt_type) { + $matchType = $opt_type; +} # my $iWant = 'ANY'; if (defined $opt_running && defined $opt_failed) { @@ -99,6 +104,10 @@ foreach my $_line (@_data) if ($matchStr ne "") { next unless ($fields[0] =~ m/$matchStr/); } + if ($matchType ne "") { + my @elem = split(/\./, $fields[0]); + next unless ($elem[$#elem] =~ m/$matchType/); + } if (not exists $dataHash{$state}) { $dataHash{$state} = 0; }