Update zabbix.api.php
This commit is contained in:
parent
bbdbe6464d
commit
3b920ba0e5
|
@ -15,6 +15,7 @@ if(!check_function_exists("get_zabbix_config")) {
|
||||||
"host" => get_value_in_array("zabbix_host", $config, "127.0.0.1"),
|
"host" => get_value_in_array("zabbix_host", $config, "127.0.0.1"),
|
||||||
"username" => get_value_in_array("zabbix_username", $config, "Admin"),
|
"username" => get_value_in_array("zabbix_username", $config, "Admin"),
|
||||||
"password" => get_value_in_array("zabbix_password", $config, "zabbix"),
|
"password" => get_value_in_array("zabbix_password", $config, "zabbix"),
|
||||||
|
"protocol" => get_value_in_array("zabbix_protocol", $config, "http"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,11 +33,14 @@ if(!check_function_exists("zabbix_get_id")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("zabbix_authenticate")) {
|
if(!check_function_exists("zabbix_authenticate")) {
|
||||||
function zabbix_authenticate($host, $username, $password, $protocol="http") {
|
function zabbix_authenticate() {
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
|
// get zabbix configuration
|
||||||
|
$cnf = get_zabbix_config();
|
||||||
|
|
||||||
// get zabbix api url
|
// get zabbix api url
|
||||||
$zabbix_api_url = zabbix_get_api_url($host, $protocol);
|
$zabbix_api_url = zabbix_get_api_url($cnf['host'], $cnf['protocol']);
|
||||||
|
|
||||||
// connect to zabbix server
|
// connect to zabbix server
|
||||||
if(loadHelper("webpagetool")) {
|
if(loadHelper("webpagetool")) {
|
||||||
|
@ -48,8 +52,8 @@ if(!check_function_exists("zabbix_authenticate")) {
|
||||||
"jsonrpc" => "2.0",
|
"jsonrpc" => "2.0",
|
||||||
"method" => "user.login",
|
"method" => "user.login",
|
||||||
"params" => array(
|
"params" => array(
|
||||||
"user" => $username,
|
"user" => $cnf['username'],
|
||||||
"password" => $password,
|
"password" => $cnf['password'],
|
||||||
),
|
),
|
||||||
"id" => zabbix_get_id(),
|
"id" => zabbix_get_id(),
|
||||||
"auth" => null,
|
"auth" => null,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user