Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    PHP Error: Uncaught ValueError in /usr/local/www/rrd_fetch_json.php:431

    Scheduled Pinned Locked Moved Traffic Monitoring
    3 Posts 2 Posters 614 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      hb9hil
      last edited by

      I really don't know since when this error appeared. But if I try to open Status > Monitoring I got this error in the GUI:

      Error: JSON not returned. Check to make sure you have an active session

      Additionally I got this error message as Notification:

      PHP ERROR: Type: 1, File: /usr/local/www/rrd_fetch_json.php, Line: 431, Message: Uncaught ValueError: min(): Argument #1 ($value) must contain at least one element in /usr/local/www/rrd_fetch_json.php:431
      Stack trace:
      #0 /usr/local/www/rrd_fetch_json.php(431): min(Array)
      #1 {main}
      thrown

      Any suggestions what happened here and how to solve it?

      pfSense Plus Home (VM)
      v23.01

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        Looks like https://redmine.pfsense.org/issues/13936

        But normally that would only happen if a graph database you're trying to access is empty or doesn't exist. For example just after resetting the database files. Once they have data that error shouldn't appear.

        But it's fixed in the next version.

        You can try applying this diff in the system patches package in the meantime:

        diff --git a/sysutils/pfSense-Status_Monitoring/files/usr/local/www/rrd_fetch_json.php b/sysutils/pfSense-Status_Monitoring/files/usr/local/www/rrd_fetch_json.php
        index 4d7574819ac969f4fde3fab65efa81490bfd195c..43a469b52e56f0a8b62fce548e4c5839ac6c8b28 100644
        --- a/blah/usr/local/www/rrd_fetch_json.php
        +++ b/blah/usr/local/www/rrd_fetch_json.php
        @@ -428,9 +428,15 @@ foreach ($side as $settings) {
         		$entry['unit_desc'] = $settings['unit_desc'];
         		$entry['invert'] = false;
         		$entry['ninetyfifth'] = true;
        -		$entry['min'] = min($inpass_stats);
        -		$entry['max'] = max($inpass_stats);
        -		$entry['avg'] = array_sum($inpass_stats) / count($inpass_stats);
        +		if ( is_array($inpass_stats) && !empty($inpass_stats) ) {
        +			$entry['min'] = min($inpass_stats);
        +			$entry['max'] = max($inpass_stats);
        +			$entry['avg'] = array_sum($inpass_stats) / count($inpass_stats);
        +		} else {
        +			$entry['min'] = 0;
        +			$entry['max'] = 0;
        +			$entry['avg'] = 0;
        +		}
         		$entry['values'] = $inpass_total;
         		$obj[] = $entry;
         
        @@ -443,9 +449,15 @@ foreach ($side as $settings) {
         		$entry['unit_desc'] = $settings['unit_desc'];
         		$entry['invert'] = $invert_graph;
         		$entry['ninetyfifth'] = true;
        -		$entry['min'] = min($outpass_stats);
        -		$entry['max'] = max($outpass_stats);
        -		$entry['avg'] = array_sum($outpass_stats) / count($outpass_stats);
        +		if ( is_array($outpass_stats) && !empty($outpass_stats) ) {
        +			$entry['min'] = min($outpass_stats);
        +			$entry['max'] = max($outpass_stats);
        +			$entry['avg'] = array_sum($outpass_stats) / count($outpass_stats);
        +		} else {
        +			$entry['min'] = 0;
        +			$entry['max'] = 0;
        +			$entry['avg'] = 0;
        +		}
         		$entry['values'] = $outpass_total;
         		$obj[] = $entry;
         	}
        

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 1
        • H
          hb9hil
          last edited by

          Thank you very much! I did some research before but never checked redmine. 😆

          Problem solved with the patch

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.