| 1 | package Zabbix::Check::RabbitMQ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | Zabbix::Check::RabbitMQ - Zabbix check for RabbitMQ service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | version 1.10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | Zabbix check for RabbitMQ service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | UserParameter=cpan.zabbix.check.rabbitmq.installed,/usr/bin/perl -MZabbix::Check::RabbitMQ -e_installed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | UserParameter=cpan.zabbix.check.rabbitmq.running,/usr/bin/perl -MZabbix::Check::RabbitMQ -e_running | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | UserParameter=cpan.zabbix.check.rabbitmq.vhost_discovery[*],/usr/bin/perl -MZabbix::Check::RabbitMQ -e_vhost_discovery -- $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | UserParameter=cpan.zabbix.check.rabbitmq.queue_discovery[*],/usr/bin/perl -MZabbix::Check::RabbitMQ -e_queue_discovery -- $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | UserParameter=cpan.zabbix.check.rabbitmq.queue_status[*],/usr/bin/perl -MZabbix::Check::RabbitMQ -e_queue_status -- $1 $2 $3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | =head3 installed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | checks RabbitMQ is installed: 0 | 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | =head3 running | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | checks RabbitMQ is installed and running: 0 | 1 | 2 = not installed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | =head3 vhost_discovery $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | discovers RabbitMQ vhosts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | $1: I<cache expiry in seconds, by default 0> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | =head3 queue_discovery $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | discovers RabbitMQ queues | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | $1: I<cache expiry in seconds, by default 0> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | =head3 queue_status $1 $2 $3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | gets RabbitMQ queue status using queue discovery cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | $1: I<vhost name> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | $2: I<queue name> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | $3: I<type: ready|unacked|total> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | no warnings qw(qw utf8); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | use v5.14; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | use Lazy::Utils; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | ▶ | use Zabbix::Check; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | BEGIN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 1 | ▶ | require Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | # set the version for version checking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | our $VERSION = '1.10'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # Inherit from Exporter to export functions and variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # Functions and variables which are exported by default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | our @EXPORT = qw(_installed _running _vhost_discovery _queue_discovery _queue_status); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # Functions and variables which can be optionally exported | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | our @EXPORT_OK = qw(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | our ($rabbitmqctl) = whereisBin('rabbitmqctl'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | sub getVhosts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | return unless $rabbitmqctl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getVhosts: not called CC=3 SCAR=24.8
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my ($expiry) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | $expiry = -1 unless defined($expiry); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | my $result = fileCache("all", $expiry, sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | my $result = {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $first = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | for my $line (`$rabbitmqctl list_vhosts 2>/dev/null`) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | if ($first) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $first = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my ($name) = $line =~ /^(.*)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $result->{$name} = { 'name' => $name }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | sub getQueues | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | return unless $rabbitmqctl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getQueues: not called CC=3 SCAR=24.8
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my ($vhost, $expiry) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | my $vhostS = shellmeta($vhost); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | $expiry = -1 unless defined($expiry); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | my $result = fileCache($vhost, $expiry, sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $result = {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $first = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | for my $line (`$rabbitmqctl list_queues -p \"$vhostS\" name messages_ready messages_unacknowledged messages 2>/dev/null`) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | if ($first) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $first = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my ($name, $ready, $unacked, $total) = $line =~ m/^([^\t]+)\t+([^\t]+)\t+([^\t]+)\t+([^\t]+)\t*/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $result->{$name} = {'ready' => $ready, 'unacked' => $unacked, 'total' => $total}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | sub _installed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | my $result = $rabbitmqctl? 1: 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_installed: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | print $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | sub _running | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | my $result = 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_running: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if ($rabbitmqctl) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | system "$rabbitmqctl cluster_status >/dev/null 2>&1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | $result = ($? == 0)? 1: 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | print $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | sub _vhost_discovery | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | my ($expiry) = map(zbxDecode($_), @ARGV); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_vhost_discovery: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | $expiry = 0 unless defined($expiry); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | my $vhosts = getVhosts($expiry); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | $vhosts = {} unless $vhosts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | for my $vhost (keys %$vhosts) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | push @items, { vhost => $vhost }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | return printDiscovery(@items); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | sub _queue_discovery | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | my ($expiry) = map(zbxDecode($_), @ARGV); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_queue_discovery: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | $expiry = 0 unless defined($expiry); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my $vhosts = getVhosts($expiry); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | $vhosts = {} unless $vhosts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | for my $vhost (keys %$vhosts) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | my $queues = getQueues($vhost, $expiry); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | $queues = {} unless $queues; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | for my $queue (keys %$queues) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | push @items, { vhost => $vhost, queue => $queue }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | return printDiscovery(@items); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | sub _queue_status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | my ($vhost, $queue, $type) = map(zbxDecode($_), @ARGV); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_queue_status: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | return unless $vhost and $queue and $type and $type =~ /^ready|unacked|total$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$vhost and $queue and $type and $type =~ /^ready|unacked|total$/u
$vhost and $queue and $type
$vhost and $queue
MC/DC0%0/4
$vhost and $queue and $type and $type =~ /^ready|unacked|total$/u
$vhost
$queue
$type
$type =~ /^ready|unacked|total$/u
Truth table0%0/5
A and B and C and D
A= $vhostB= $queueC= $typeD= $type =~ /^ready|unacked|total$/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my $result = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my $queues = getQueues($vhost); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | $result = $queues->{$queue}->{$type} if defined($queues->{$queue}->{$type}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | print $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||