Giter Site home page Giter Site logo

Comments (5)

edeckers avatar edeckers commented on September 26, 2024

Hi @stephanehofman , I've analyzed this code, but I fail to see how this specific error can occur. Are you absolutely sure you're using the latest version of the script? I'll share my observations below so maybe someone else can chime in with new insights.

Observations

The error occurs on lines 1131 and 1139 where the value of $revoked_cert_refs appears to be NULL, that issue was supposed to be fixed by initializing $revoked_cert_refs with an empty array on line 1119. So, since it is initialized with value [] it has to be set to NULL explicitly somewhere down the line to cause the errors you're experiencing. However, there are only four usages of $revoked_cert_refs in the entire script, two of which are assignments:

image

On line 1119 you'll find the initial assignment I mentioned earlier, and the other mutation of the array is on line 1122 where an item is pushed to the end of it. So if there is a bug in the latest version of the script, then I expect this to be the culprit. I fail to see how though, because I've tried to upset PHP with some possible troublesome inputs but to no avail:

<?php 
$xs = [];
var_dump($xs);
// array(0) {
// }

$xs[] = 1;
var_dump($xs);
// array(1) {
//   [0]=>
//   int(1)
// }

$xs[] = NULL;
var_dump($xs);
// array(2) {
//   [0]=>
//   int(1)
//   [1]=>
//   NULL
// }

var_dump(in_array("62399625c19f2", $xs));
// bool(false)
var_dump(in_array("62399625c19f2", [NULL]));
// bool(false)

from pfsense-zabbix-template.

stephanehofman avatar stephanehofman commented on September 26, 2024

I have downloaded this version :
https://raw.githubusercontent.com/rbicelli/pfsense-zabbix-template/master/pfsense_zbx.php

from pfsense-zabbix-template.

edeckers avatar edeckers commented on September 26, 2024

That is the correct url; I'm not sure how to reproduce the problem then unfortunately :(

Hopefully somebody else can help.

from pfsense-zabbix-template.

jysl avatar jysl commented on September 26, 2024

I am just a system admin that don't know how to code, and not sure what i am doing but hope this help

That pfsense_zbx.php work for me but I do need to make the change that LegsAJimbo sugguested on the fix

With that said, I managed to suppress the error by changing line 978 from:
if (count($leases) > 0) {
to
if (is_countable($leases) && count($leases) > 0) {

And line 982 from:
if (count($pools) > 0) {
to
if (is_countable($pools) && count($pools) > 0) {

Also I need to make the change on openvpn for the status on the openvpn to work, thanks hvdhelm on that

// Value mappings
// Each value map is represented by an associative array
function pfz_valuemap($valuename, $value, $default="0"){
switch ($valuename){

      case "openvpn.server.status":          
                $valuemap = array(
                     "down" => "0",
                     "up" => "1",
                     "connected (success)" => "1",
                     "none" => "2",
                     "reconnecting; ping-restart" => "3",
                     "waiting" => "4",
                     "server_user_listening" => "5");          
      break;
      
      case "openvpn.client.status":          
                $valuemap = array(
                     "up" => "1",
                     "connected (success)" => "1",
                     "down" => "0",
                     "none" => "0",
                     "reconnecting; ping-restart" => "2");          
      break;

from pfsense-zabbix-template.

Yarli avatar Yarli commented on September 26, 2024

I had this same problem today, and just copied the raw code and replaced my existing content of the pfsense_zbx.php file and it fixed my problem.

Ignore the version comment at the top of the code in that file. I don't think it's been updated for a while. There was a change to the file a month ago, so not sure if that fixed this issue or not.

from pfsense-zabbix-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.