Added fix for captive portal

master
Riccardo Bicelli 5 years ago
parent 3e0a41e2d1
commit 40714dc92f
  1. 22
      pfsense_zbx.php

@ -152,8 +152,11 @@ function pfz_services_discovery(){
$status = get_service_status($service); $status = get_service_status($service);
if ($status="") $status = 0; if ($status="") $status = 0;
if (empty($service['id'])) $id=""; $id="";
else $id = "." . $service["id"]; //id for OpenVPN
if (!empty($service['id'])) $id = "." . $service["id"];
//zone for Captive Portal
if (!empty($service['zone')) $id = "." . $service["zone"];
$json_string .= '{"{#SERVICE}":"' . $service['name'] . $id . '"'; $json_string .= '{"{#SERVICE}":"' . $service['name'] . $id . '"';
$json_string .= ',"{#DESCRIPTION}":"' . $service['description'] . '"'; $json_string .= ',"{#DESCRIPTION}":"' . $service['description'] . '"';
@ -177,14 +180,21 @@ function pfz_service_value($name,$value){
$stopped_on_carp_slave = array("haproxy","openvpn."); $stopped_on_carp_slave = array("haproxy","openvpn.");
foreach ($services as $service){ foreach ($services as $service){
if (empty($service['id'])) { $namecfr=$service["name"];
$namecfr=$service["name"]; $carpcfr=$service["name"];
$carpcfr=$service["name"];
} else { //OpenVPN
if (!empty($service['id'])) {
$namecfr = $service['name'] . "." . $service["id"]; $namecfr = $service['name'] . "." . $service["id"];
$carpcfr = $service['name'] . "."; $carpcfr = $service['name'] . ".";
} }
//Captive Portal
if (!empty($service['zone'])) {
$namecfr = $service['name'] . "." . $service["zone"];
$carpcfr = $service['name'] . ".";
}
if ($namecfr == $name){ if ($namecfr == $name){
switch ($value) { switch ($value) {

Loading…
Cancel
Save