statusengine / interface

AngularJS based Web Interface for Statusengine
https://statusengine.org/ui/#overview
GNU General Public License v3.0
18 stars 7 forks source link

Feature: Support Graphite Subdirectory #35

Closed gangsterrapper22 closed 4 years ago

gangsterrapper22 commented 4 years ago

Hi @nook24

I have changed something in the Graphite Implementation, because I have running Graphite in a Subdirecotry and not directly in the main Root Path.

I have added in the Config.yml and in the Config.php a Setting with the Name "graphite_subdir:". If you set for example graphite_subdir: /graphite then it call add /graphite before the render command. For example http://localhost:8000/graphite/render If Graphite still is in the Root Path, you can let the setting empty or remove it from the Settings.

These are the Changes with I have made.

Config.yml graphite_subdir: "/graphite" Only example setting Config.php

    /**
     * @return string
     */
    public function getGraphiteSubDir() {
        $default = "";
        $default = Env::get('SEI_GRAPHITE_SUBDIR', $default);
        if (isset($this->config['graphite_subdir'])) {
            return (string)$this->config['graphite_subdir'];
        }
        return $default;
    }

In src/Loader/Graphite/ServicePerfdataLoader.php I have changed this:

Under public function getServicePerfdata(ServicePerfdataQueryOptions $ServicePerfdataQueryOptions) I have added: $graphitesubdir = $this->Config->getGraphiteSubDir();

I have changed the Line

$response = $client->request('GET', '/render', $options); to $response = $client->request('GET', "$graphitesubdir/render", $options);

Please check from your side, if you want a Change like that or not. I hope I have missed nothing which I have changed. Maybe if possible ou can also try it first on your side.

Thank you.

nook24 commented 4 years ago

Did changing the graphite_url to http://localhost:8080/graphite not resolve this issue?

nook24 commented 4 years ago

Arg... GitHub closed this. Sorry for this.

I removed the base_uri of GuzzleHttp because maybe it's buggy?

How ever, changing the graphite_url to http://localhost:8080/graphite in config.yml should now be enough to make this work. Would be good if you could test this, I don't have Graphite setup at the moment.

gangsterrapper22 commented 4 years ago

No problem. I have tested it now with your fix and it worked for me. I set the config to graphite_url: http://localhost:8000/graphite

Thanks.

gangsterrapper22 commented 4 years ago

No problem. I have tested it now with your fix and it worked for me. I set the config to graphite_url: http://localhost:8000/graphite

Thanks.