| 1 | package Zabbix::Check; | ||||||||||||||||||||||||||||
| 2 | =head1 NAME | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | Zabbix::Check - System and service checks for Zabbix | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | =head1 VERSION | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | version 1.10 | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | System and service checks for Zabbix | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | UserParameter=cpan.zabbix.check.version,/usr/bin/perl -MZabbix::Check -e_version | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head3 version | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | gets Zabbix::Check version | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =head2 Disk | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | Zabbix check for disk | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | UserParameter=cpan.zabbix.check.disk.discovery,/usr/bin/perl -MZabbix::Check::Disk -e_discovery | ||||||||||||||||||||||||||||
| 25 | UserParameter=cpan.zabbix.check.disk.bps[*],/usr/bin/perl -MZabbix::Check::Disk -e_bps -- $1 $2 | ||||||||||||||||||||||||||||
| 26 | UserParameter=cpan.zabbix.check.disk.iops[*],/usr/bin/perl -MZabbix::Check::Disk -e_iops -- $1 $2 | ||||||||||||||||||||||||||||
| 27 | UserParameter=cpan.zabbix.check.disk.ioutil[*],/usr/bin/perl -MZabbix::Check::Disk -e_ioutil -- $1 | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =head3 discovery | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | discovers disks | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =head3 bps $1 $2 | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | gets disk I/O traffic in bytes per second | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | $1: I<device name, eg: sda, sdb1, dm-3, ...> | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | $2: I<type: read|write|total> | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | =head3 iops $1 $2 | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | gets disk I/O transaction speed in transactions per second | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | $1: I<device name, eg: sda, sdb1, dm-3, ...> | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | $2: I<type: read|write|total> | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | =head3 ioutil $1 $2 | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | gets disk I/O utilization in percentage | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | $1: I<device name, eg: sda, sdb1, dm-3, ...> | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | =head2 Supervisor | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | Zabbix check for Supervisor service | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | UserParameter=cpan.zabbix.check.supervisor.installed,/usr/bin/perl -MZabbix::Check::Supervisor -e_installed | ||||||||||||||||||||||||||||
| 60 | UserParameter=cpan.zabbix.check.supervisor.running,/usr/bin/perl -MZabbix::Check::Supervisor -e_running | ||||||||||||||||||||||||||||
| 61 | UserParameter=cpan.zabbix.check.supervisor.worker_discovery,/usr/bin/perl -MZabbix::Check::Supervisor -e_worker_discovery | ||||||||||||||||||||||||||||
| 62 | UserParameter=cpan.zabbix.check.supervisor.worker_status[*],/usr/bin/perl -MZabbix::Check::Supervisor -e_worker_status -- $1 | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =head3 installed | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | checks Supervisor is installed: 0 | 1 | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =head3 running | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | checks Supervisor is installed and running: 0 | 1 | 2 = not installed | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =head3 worker_discovery | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | discovers Supervisor workers | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head3 worker_status $1 | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | gets Supervisor worker status: RUNNING | STOPPED | ... | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | $1: I<worker name> | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =head2 RabbitMQ | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | Zabbix check for RabbitMQ service | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | UserParameter=cpan.zabbix.check.rabbitmq.installed,/usr/bin/perl -MZabbix::Check::RabbitMQ -e_installed | ||||||||||||||||||||||||||||
| 87 | UserParameter=cpan.zabbix.check.rabbitmq.running,/usr/bin/perl -MZabbix::Check::RabbitMQ -e_running | ||||||||||||||||||||||||||||
| 88 | UserParameter=cpan.zabbix.check.rabbitmq.vhost_discovery[*],/usr/bin/perl -MZabbix::Check::RabbitMQ -e_vhost_discovery -- $1 | ||||||||||||||||||||||||||||
| 89 | UserParameter=cpan.zabbix.check.rabbitmq.queue_discovery[*],/usr/bin/perl -MZabbix::Check::RabbitMQ -e_queue_discovery -- $1 | ||||||||||||||||||||||||||||
| 90 | UserParameter=cpan.zabbix.check.rabbitmq.queue_status[*],/usr/bin/perl -MZabbix::Check::RabbitMQ -e_queue_status -- $1 $2 $3 | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =head3 installed | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | checks RabbitMQ is installed: 0 | 1 | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | =head3 running | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | checks RabbitMQ is installed and running: 0 | 1 | 2 = not installed | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | =head3 vhost_discovery $1 | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | discovers RabbitMQ vhosts | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | $1: I<cache expiry in seconds, by default 0> | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =head3 queue_discovery $1 | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | discovers RabbitMQ queues | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | $1: I<cache expiry in seconds, by default 0> | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | =head3 queue_status $1 $2 $3 | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | gets RabbitMQ queue status using queue discovery cache | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | $1: I<vhost name> | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | $2: I<queue name> | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | $3: I<type: ready|unacked|total> | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =head2 Systemd | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | Zabbix check for Systemd services | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | UserParameter=cpan.zabbix.check.systemd.installed,/usr/bin/perl -MZabbix::Check::Systemd -e_installed | ||||||||||||||||||||||||||||
| 127 | UserParameter=cpan.zabbix.check.systemd.system_status,/usr/bin/perl -MZabbix::Check::Systemd -e_system_status | ||||||||||||||||||||||||||||
| 128 | UserParameter=cpan.zabbix.check.systemd.service_discovery[*],/usr/bin/perl -MZabbix::Check::Systemd -e_service_discovery -- $1 | ||||||||||||||||||||||||||||
| 129 | UserParameter=cpan.zabbix.check.systemd.service_status[*],/usr/bin/perl -MZabbix::Check::Systemd -e_service_status -- $1 | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | =head3 installed | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | checks Systemd is installed: 0 | 1 | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | =head3 system_status | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | gets Systemd system status: initializing | starting | running | degraded | maintenance | stopping | offline | unknown | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | =head3 service_discovery | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | discovers Systemd enabled services | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | $1: I<regex of service name, by default undefined> | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | =head3 service_status $1 | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | gets Systemd enabled service status: active | inactive | failed | unknown | ... | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | $1: I<service name> | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | =head2 Time | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | Zabbix check for system time | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | UserParameter=cpan.zabbix.check.time.epoch,/usr/bin/perl -MZabbix::Check::Time -e_epoch | ||||||||||||||||||||||||||||
| 156 | UserParameter=cpan.zabbix.check.time.zone,/usr/bin/perl -MZabbix::Check::Time -e_zone | ||||||||||||||||||||||||||||
| 157 | UserParameter=cpan.zabbix.check.time.ntp_offset[*],/usr/bin/perl -MZabbix::Check::Time -e_ntp_offset -- $1 $2 | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =head3 epoch | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | gets system time epoch in seconds | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | =head3 zone | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | gets system time zone, eg: +0200 | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | =head3 ntp_offset $1 $2 | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | gets system time difference by NTP server | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | $1: I<server, by defaut pool.ntp.org> | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | $2: I<port, by default 123> | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | =cut | ||||||||||||||||||||||||||||
| 176 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 177 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 178 | 1 | ▶ | no warnings qw(qw utf8); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 179 | 1 | ▶ | use v5.14; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 180 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 181 | 1 | ▶ | use Config; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 182 | 1 | ▶ | use Switch; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 183 | 1 | ▶ | use FindBin; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 184 | 1 | ▶ | use Cwd; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 185 | 1 | ▶ | use File::Basename; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 186 | 1 | ▶ | use File::Slurp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 187 | 1 | ▶ | use JSON; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 188 | 1 | ▶ | use Net::NTP; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 189 | 1 | ▶ | use Lazy::Utils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | BEGIN | ||||||||||||||||||||||||||||
| 193 | { | ||||||||||||||||||||||||||||
| 194 | 1 | ▶ | require Exporter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 195 | # set the version for version checking | ||||||||||||||||||||||||||||
| 196 | 1 | our $VERSION = '1.10'; | |||||||||||||||||||||||||||
| 197 | # Inherit from Exporter to export functions and variables | ||||||||||||||||||||||||||||
| 198 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 199 | # Functions and variables which are exported by default | ||||||||||||||||||||||||||||
| 200 | 1 | our @EXPORT = qw(zbxEncode zbxDecode printDiscovery _version); | |||||||||||||||||||||||||||
| 201 | # Functions and variables which can be optionally exported | ||||||||||||||||||||||||||||
| 202 | 1 | our @EXPORT_OK = qw(); | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 1 | our @zbxSpecials = qw(\ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @); | |||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | sub zbxEncode | ||||||||||||||||||||||||||||
| 210 | { | ||||||||||||||||||||||||||||
| 211 | 0 | ▶ | my $result = ""; | ||||||||||||||||||||||||||
|
Subroutine
zbxEncode: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 212 | 0 | my ($str) = @_; | |||||||||||||||||||||||||||
| 213 | 0 | ▶ | return $result unless $str; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 0 | ▶ | for (my $i = 0; $i < length $str; $i++) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | { | ||||||||||||||||||||||||||||
| 216 | 0 | my $chr = substr $str, $i, 1; | |||||||||||||||||||||||||||
| 217 | 0 | ▶ | if (not $chr =~ /[ -~]/g or grep ($_ eq $chr, (@zbxSpecials, '%', ','))) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $chr =~ /[ -~]/gu or grep(($_ eq $chr), (@Zabbix::Check::zbxSpecials, "%", ","))
MC/DC0%0/2
not $chr =~ /[ -~]/gu or grep(($_ eq $chr), (@Zabbix::Check::zbxSpecials, "%", ","))
not $chr =~ /[ -~]/gu
grep(($_ eq $chr), (@Zabbix::Check::zbxSpecials, "%", ","))
Truth table0%0/3
not(A) or B
A= not $chr =~ /[ -~]/guB= grep(($_ eq $chr), (@Zabbix::Check::zbxSpecials, "%", ","))
| |||||||||||||||||||||||||||||
| 218 | { | ||||||||||||||||||||||||||||
| 219 | 0 | $result .= uc sprintf("%%%x", ord($chr)); | |||||||||||||||||||||||||||
| 220 | } else | ||||||||||||||||||||||||||||
| 221 | { | ||||||||||||||||||||||||||||
| 222 | 0 | $result .= $chr; | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | 0 | return $result; | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | sub zbxDecode | ||||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||
| 230 | 0 | ▶ | my $result = ""; | ||||||||||||||||||||||||||
|
Subroutine
zbxDecode: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 231 | 0 | my ($str) = @_; | |||||||||||||||||||||||||||
| 232 | 0 | ▶ | return $result unless $str; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 233 | 0 | my ($i, $len) = (0, length $str); | |||||||||||||||||||||||||||
| 234 | 0 | ▶ | while ($i < $len) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | { | ||||||||||||||||||||||||||||
| 236 | 0 | my $chr = substr $str, $i, 1; | |||||||||||||||||||||||||||
| 237 | 0 | ▶ | if ($chr eq '%') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 238 | { | ||||||||||||||||||||||||||||
| 239 | 0 | ▶ | return $result if $len-$i-1 < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | 0 | $result .= chr(hex(substr($str, $i+1, 2))); | |||||||||||||||||||||||||||
| 241 | 0 | $i += 2; | |||||||||||||||||||||||||||
| 242 | } else | ||||||||||||||||||||||||||||
| 243 | { | ||||||||||||||||||||||||||||
| 244 | 0 | $result .= $chr; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | 0 | $i++; | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | 0 | return $result; | |||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | sub printDiscovery | ||||||||||||||||||||||||||||
| 252 | { | ||||||||||||||||||||||||||||
| 253 | 0 | ▶ | my @items = @_; | ||||||||||||||||||||||||||
|
Subroutine
printDiscovery: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 254 | my $discovery = { | ||||||||||||||||||||||||||||
| 255 | data => [ | ||||||||||||||||||||||||||||
| 256 | map({ | ||||||||||||||||||||||||||||
| 257 | 0 | my $item = $_; | |||||||||||||||||||||||||||
| 258 | my %newitem = map({ | ||||||||||||||||||||||||||||
| 259 | 0 | my $key = $_; | |||||||||||||||||||||||||||
| 260 | 0 | my $val = $item->{$key}; | |||||||||||||||||||||||||||
| 261 | 0 | my $newkey = zbxEncode($key); | |||||||||||||||||||||||||||
| 262 | 0 | $newkey = uc("{#$newkey}"); | |||||||||||||||||||||||||||
| 263 | 0 | my $newval = zbxEncode($val); | |||||||||||||||||||||||||||
| 264 | 0 | $newkey => $newval; | |||||||||||||||||||||||||||
| 265 | } keys(%$item)); | ||||||||||||||||||||||||||||
| 266 | 0 | \%newitem; | |||||||||||||||||||||||||||
| 267 | } @items), | ||||||||||||||||||||||||||||
| 268 | ], | ||||||||||||||||||||||||||||
| 269 | }; | ||||||||||||||||||||||||||||
| 270 | 0 | my $result = to_json($discovery, {pretty => 1}); | |||||||||||||||||||||||||||
| 271 | 0 | print $result; | |||||||||||||||||||||||||||
| 272 | 0 | return $result; | |||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | sub _version | ||||||||||||||||||||||||||||
| 276 | { | ||||||||||||||||||||||||||||
| 277 | 0 | ▶ | my $result = ""; | ||||||||||||||||||||||||||
|
Subroutine
_version: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 278 | 0 | $result = $Zabbix::Check::VERSION; | |||||||||||||||||||||||||||
| 279 | 0 | print $result; | |||||||||||||||||||||||||||
| 280 | 0 | return $result; | |||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 1 | my $osname = $Config{osname}; | |||||||||||||||||||||||||||
| 285 | 1 | ▶ | warn "OS '$osname' is not supported" unless $osname eq 'linux'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 1 | 1; | |||||||||||||||||||||||||||
| 288 | __END__ | ||||||||||||||||||||||||||||