Using:
Zabbix server v2.4.7 (revision 56694) (12 November 2015)
I'm am seeing unexpected return values in the output from my perl script that is supposed to return the percentage uptime and other values. I'm able to access the API but with unexpected results. I'm sure it's just a syntax issue in the parms section of the code but not sure the correct syntax. If you have suggestion on the correct syntax, I would appreciate it. Here is the perl script:
I'm expecting to get back the percentage uptime between
intervals => ["1471824000", "1472428800"],
August 22nd thru August 29th, but it returns 100 instead of 99.73 that is displayed in the Monitoring/IT Services screen in the Zabbix Frontend. It is also returning "1" in the from and to fields of the output.
Any thoughts are appreciated.
Zabbix server v2.4.7 (revision 56694) (12 November 2015)
I'm am seeing unexpected return values in the output from my perl script that is supposed to return the percentage uptime and other values. I'm able to access the API but with unexpected results. I'm sure it's just a syntax issue in the parms section of the code but not sure the correct syntax. If you have suggestion on the correct syntax, I would appreciate it. Here is the perl script:
Code:
#!c:\perl64\bin\perl
use 5.010;
use strict;
use warnings;
use JSON::RPC::Client;
use Data::Dumper;
# Authenticate yourself
my $client = new JSON::RPC::Client;
my $url = 'http://#######/zabbix/api_jsonrpc.php';
my $response;
my $json = {
jsonrpc=> '2.0',
method => 'service.getsla',
params =>
{
serviceids => "75",
intervals => ["1471824000", "1472428800"],
},
id => 1,
auth => "XXXXXXXXXXXXXXXXXXXXXXXXXX",
};
$response = $client->call($url, $json);
print Dumper($response);
printf "%s\n",$respon
intervals => ["1471824000", "1472428800"],
August 22nd thru August 29th, but it returns 100 instead of 99.73 that is displayed in the Monitoring/IT Services screen in the Zabbix Frontend. It is also returning "1" in the from and to fields of the output.
Code:
$VAR1 = bless( {
'content' => {
'jsonrpc' => '2.0',
'result' => {
'75' => {
'problems' => [],
'status' => '0',
'sla' => [
{
'problemTime' => 0,
'okTime' => 0,
'downtimeTime' => 0,
'sla' => 100,
'from' => '1',
'to' => '1'
},
{
'okTime' => 0,
'problemTime' => 0,
'to' => '1',
'downtimeTime' => 0,
'sla' => 100,
'from' => '1'
}
]
}
},
'id' => 1
},
'is_success' => 1,
'jsontext' => '{"jsonrpc":"2.0","result":{"75":{"status":"0","problems":[],"sla":[{"from":"1","to":"1","sla":100,"okTime":0,"problemTime":0,"downtimeTime":0},{"from":"1","to":"1","sla":100,"okTime":0,"problemTime":0,"downtimeTime":0}]}},"id":1}',
'version' => 0
}, 'JSON::RPC::ReturnObject' );
JSON::RPC::ReturnObject=HASH(0x3714dd0
Comment