Hello all,
Looking for some assistance in redesigning my Perl script to pull specific data directly from the MySQL database as opposed to using the API module:
I have a working CGI script that uses the below snippets to reference an API available. This works fine and I can get the info I need, but it is slow and can take 4-7 minutes to display a simple table of 20 hosts with 10 values each. This is inefficient and I want to query the MySQL database directly.
Zabbix Version: 4.0
I then go and parse the resulting JSON (I believe) formatted output, pull out the values I need to display my table. the $hostnumber is previously pulled from the hosts table and is passed on from a foreach loop.
Is there a way to convert the above query into a direct MySQL query?
Thanks in advance for any assistance.
Looking for some assistance in redesigning my Perl script to pull specific data directly from the MySQL database as opposed to using the API module:
I have a working CGI script that uses the below snippets to reference an API available. This works fine and I can get the info I need, but it is slow and can take 4-7 minutes to display a simple table of 20 hosts with 10 values each. This is inefficient and I want to query the MySQL database directly.
Zabbix Version: 4.0
Code:
use Zabbix::Tiny;
my $zabbix = Zabbix::Tiny->new(
server => $url,
password => $password,
user => $username
);
Code:
sub get_item_values {
$valueparams = {
output => [qw(hostid itemid key_ lastvalue)], # Remaining paramters to 'do' are the params for the zabbix method.
monitored => 1,
hostids => $hostnumber,
limit => 1,
## Any other params desired
};
$items = $zabbix->do(
'item.get', # First argument is the Zabbix API method
{
$valueparams
}
);
}
Is there a way to convert the above query into a direct MySQL query?
Thanks in advance for any assistance.