Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Need help with first Emoncms setup on synology diskstation

@borpin

What does this error mean?

No idea!

Hello @Tehnoinstyle_Aleksey there should be more to the error message that will hopefully tell us which variable is undefined?

Hello, @TrystanLea

There are no more entries in the error messages. Only these.

These notes appeared on a clean installation of EmonSMS, after adding Feeds.

Thanks.

This is the crucial bit of info!

image

Hello @borpin

May be! But I just can not see this message completely. And it is not recorded in the logs. How and where can I see it?

Hmm. From apache24-error_log

2020-01-06T08:58:09+02:00 DS3615HOME [Mon Jan 06 08:58:09.955111 2020] [proxy_fcgi:error] [pid 17473:tid 140685126588160] [client 192.168.1.200:35066] AH01071: Got error 'PHP message: PHP Warning:  file_exists(): open_basedir restriction in effect. File(/usr/sbin/mosquitto) is not within the allowed path(s): (/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfiwa:/var/lib/phpfina:/var/lib/phptimeseries:/var/log/emoncms) in /volume1/web/emoncms/Modules/admin/admin_model.php on line 318\nPHP message: PHP Notice:  Undefined index: total in /volume1/web/emoncms/Modules/admin/admin_main_view.php on line 304\nPHP message: PHP Notice:  Undefined index: free in /volume1/web/emoncms/Modules/admin/admin_main_view.php on line 306\n', referer: http://192.168.1.254/emoncms/feed/view

I am not use mosquitto

I’ve raised a new issue

@emrys

@Tehnoinstyle_Aleksey can you try this and see if it fixes the issue?

from Modules/admin/admin_model.php delete:

public static function mqtt_version() {
        $v = '?';
        if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $v = "n/a";
        } else {
            if (file_exists('/usr/sbin/mosquitto')) {
                $v = exec('/usr/sbin/mosquitto -h | grep -oP \'(?<=mosquitto\sversion\s)[0-9.]+(?=\s*)\'');
            }
        }
        return $v;
    }

and paste:

public static function mqtt_version() {
                }
            } catch (Error $e) {
                global $log;
                $log->info(_('Issue checking /usr/sbin/mosquitto').' - '.$e->getMessage());
                $v = "n/a";
            }
        }
        return $v;

yes or no?

p.s. I’m sorry, but I really have little knowledge in the code.

NO!

The lines of the file above are collapsed - click on image to see it all.

Better to click on the 3 dots to the right, and View File.

    public static function mqtt_version() {
        $v = '?';
        if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $v = "n/a";
        } else {
            try {
                if (file_exists('/usr/sbin/mosquitto')) {
                    $v = exec('/usr/sbin/mosquitto -h | grep -oP \'(?<=mosquitto\sversion\s)[0-9.]+(?=\s*)\'');
                }
            } catch (Error $e) {
                global $log;
                $log->info(_('Issue checking /usr/sbin/mosquitto').' - '.$e->getMessage());
                $v = "n/a";
            }
        }
        return $v;
    }

thanks. I’m going to try now.

1 Like
public static function mqtt_version() {
        $v = '?';
        if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $v = "n/a";
        } else {
            try {
                if (file_exists('/usr/sbin/mosquitto')) {
                    $v = exec('/usr/sbin/mosquitto -h | grep -oP \'(?<=mosquitto\sversion\s)[0-9.]+(?=\s*)\'');
                }
            } catch (Error $e) {
                global $log;
                $log->info(_('Issue checking /usr/sbin/mosquitto').' - '.$e->getMessage());
                $v = "n/a";
            }
        }
        return $v;
    }

the same? only for 319 line:

2020-01-06T14:08:22+02:00 DS3615HOME [Mon Jan 06 14:08:22.465623 2020] [proxy_fcgi:error] [pid 18027:tid 140132736743168] [client 178.151.206.206:34582] AH01071: Got error 'PHP message: PHP Warning:  file_exists(): open_basedir restriction in effect. File(/usr/sbin/mosquitto) is not within the allowed path(s): (/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/var/lib/phpfiwa:/var/lib/phpfina:/var/lib/phptimeseries:/var/log/emoncms) in /volume1/web/emoncms/Modules/admin/admin_model.php on line 319\nPHP message: PHP Notice:  Undefined index: total in /volume1/web/emoncms/Modules/admin/admin_main_view.php on line 304\nPHP message: PHP Notice:  Undefined index: free in /volume1/web/emoncms/Modules/admin/admin_main_view.php on line 306\n', referer: http://192.168.1.254/emoncms/feed/list

p.s. I have returned the original admin_model.php file so far.

@emrys, looks like there are various conditions that will create an issue on a Non-Pi system. But I’ve just notice this is a WARNING not an ERROR so Try/Catch does not help!

Is this line right? If I’m not mistaken it always evaluates to true?

[edit]
For mosquitto, why not check if the service is running first? If not running locally, it is pointless information.

changed the try/catch for a custom error handler. this should catch (and log) the error if there is a directory restriction set for the install.

here’s what I changed…

direct link to commit:
[https://github.com/emoncms/emoncms/pull/1495/commits/a72b2a3418ca3a5fce99b41e5a261465124327c6]

this was added to the original pull request

@borpin, yes this snippet seems to always return true? (with the additional ‘@’ to suppress any php warnings)

if (@is_readable('/proc/cpuinfo') || true) {

unsure of the reason for this || true condition? only used on this line.

It’s the sort of trick I do when testing - I think you’ll only find out if you ask whoever put it there.

Ah, so could we use that trick to suppress the warnings on the file_exists call as well? (useful to know).

@TrystanLea @glyn.hudson my feeling this should not be there!

@borpin - I don’t like using the @ operator to suppress error messages. Better to use the custom error handler in the pull request to catch expected errors.

silently ignoring errors wont help anyone to fix the issue.

1 Like

Don’t disagree, just suggest that we are consistent :grinning:.