rbicelli / pfsense-zabbix-template

Zabbix Template for pfSense
Apache License 2.0
242 stars 107 forks source link

Gateway Status Forced Down showing as Down #70

Closed GuillaumeHullin closed 2 years ago

GuillaumeHullin commented 3 years ago

Hi, The problem I had was that when I marked a Gateway as Down, Zabbix reported me the Gateway as Down instead of forced down... The "Down" trigger is a Disaster-level, and the "forced down" is an information.

I fixed it by replacing:

function pfz_gw_value($gw, $valuekey) {
     $gws = return_gateways_status(true);
     if(array_key_exists($gw,$gws)) {
          $value = $gws[$gw][$valuekey];
          if ($valuekey=="status")
               $value = pfz_valuemap("gateway.status", $value);     
          echo $value;         
     }
}

to

function pfz_gw_value($gw, $valuekey) {
     $gws = return_gateways_status(true);
     if(array_key_exists($gw,$gws)) {
          $value = $gws[$gw][$valuekey];
          if ($valuekey=="status") { 
               if ($gws[$gw]["substatus"]<>"none") 
                    $value = $gws[$gw]["substatus"];

               $value = pfz_valuemap("gateway.status", $value);
          }     
          echo $value;         
     }
}

Sorry I think I should do a pull request from my fork to this one or something like this but I'm not sure how to do it (I'm new to Git)... If that help, here is the link to my commit. https://github.com/Futur-Tech/futur-tech-zabbix-pfsense/commit/9faeb28a912782f2009e3809c459bb58c889cfb5#diff-9874529ae15a98afff9726709aa3f7ef31b25cdd0d903ed892ebe626e64a3c57

Best regards Guillaume