Zabbix::Utils -- Useful miscellanea related to Zabbix
This is a collection of miscellaneous things useful to have in the event that you're doing something with the Zabbix::API distribution.
None so far.
None by default.
This constant (in the use constant sense) is a regular expression that will match against parts of formulas of calculated items thusly:
use constant
use Zabbix::Utils qw/RE_FORMULA/; # interpolating constants is problematic my $regexp = RE_FORMULA; my $formula = 'last("MyROuter2:ifHCInOctets5")+last("MyROuter2:ifHCInOctets23")'; while ($formula =~ m/$regexp/g) { print Dumper(\%+); }
Which should output:
$VAR1 = { 'function_call' => 'last("MyROuter2:ifHCInOctets5")', 'function_args_quote' => '"', 'item' => 'ifHCInOctets5', 'function_args' => 'MyROuter2:ifHCInOctets5', 'host' => 'MyROuter2' }; $VAR1 = { 'function_call' => 'last("MyROuter2:ifHCInOctets23")', 'function_args_quote' => '"', 'item' => 'ifHCInOctets23', 'function_args' => 'MyROuter2:ifHCInOctets23', 'host' => 'MyROuter2' };
Item arguments (system.uptime[minutes]) appear in item_arg which is not represented here (fixme!).
item_arg
You'll have noticed that this makes use of the excellent "named capture buffers" feature, which means you need Perl 5.10 or higher.
Zabbix::API, the Zabbix API documentation at http://www.zabbix.com/documentation/start.
Fabrice Gabolde <fabrice.gabolde@uperto.com>
Copyright (C) 2011 SFR
This library is free software; you can redistribute it and/or modify it under the terms of the GPLv3.
To install Zabbix::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zabbix::API
CPAN shell
perl -MCPAN -e shell install Zabbix::API
For more information on module installation, please visit the detailed CPAN module installation guide.