Page 1 of 1

List server info not working

Posted: Thu Mar 31, 2016 3:14 pm
by leisegang
I am having troubles with this file.
https://github.com/serghey-rodin/vesta/ ... /index.php

This part isnt working/not giving output.

Code: Select all

// CPU info
if (isset($_GET['cpu'])) {
    $TAB = 'CPU';
    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
    exec (VESTA_CMD.'v-list-sys-cpu-status', $output, $return_var);
    foreach($output as $file) {
        echo $file . "\n";
    }
    echo "    </pre>\n</body>\n</html>\n";
    exit();
}
// Memory info
if (isset($_GET['mem'])) {
    $TAB = 'MEMORY';
    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
    exec (VESTA_CMD.'v-list-sys-memory-status', $output, $return_var);
    foreach($output as $file) {
        echo $file . "\n";
    }
    echo "    </pre>\n</body>\n</html>\n";
    exit();
}
When running v-list-sys-cpu-status in terminal I am getting an output. a print of TOP and the CPUs.

when running v-list-sys-memory-status I get a "free -m" output and a summary after that.

The scripts seem to work but not outputting anything to that page.

Anyone have an idea how to debug this or fix this?

Re: List server info not working

Posted: Sun Apr 24, 2016 5:15 pm
by leisegang
anyone?

Re: List server info not working

Posted: Sun Apr 24, 2016 5:27 pm
by Falzo
I'd say it depends from where you are running this script. I suppose you might have put it as a single file somewhere into your public_html?
If that's the case I'd guess your php might restrict the use of exec() at all, or the user which owns the file simply isn't allowed to access vesta's cli commands ;-)

Re: List server info not working

Posted: Sun Apr 24, 2016 5:33 pm
by leisegang
I am accessing it trough the vesta cp.

https://domain.com:8083/list/server/?cpu
https://domain.com:8083/list/server/?mem

they are both blank

Re: List server info not working

Posted: Sun Apr 24, 2016 5:52 pm
by leisegang
in the file:
/usr/local/vesta/bin/v-list-sys-cpu-status

i had to change the following:

Code: Select all

# Displaying CPU information
grep 'model name' /proc/cpuinfo|cut -f 2 -d : | sed "s/ //"
echo
lscpu 2>/dev/null
to

Code: Select all

# Displaying CPU information
grep 'model name' /proc/cpuinfo|cut -f 2 -d : | sed "s/ //"
echo
#lscpu 2>/dev/null
To fix the /usr/local/vesta/bin/v-list-sys-memory-status i had to comment out

Code: Select all

#dmidecode -t 17 2>/dev/null

i am running openvz

Re: List server info not working

Posted: Sun Apr 24, 2016 6:07 pm
by Falzo
thanks for the follow up. that dmidecode wont work with ovz is understandable, and lscpu seems to lack exactly the model name row on ovz... bad luck.

Re: List server info not working

Posted: Mon Apr 25, 2016 7:26 am
by skurudo
You can try this fix:

Code: Select all

wget https://raw.githubusercontent.com/serghey-rodin/vesta/master/web/list/server/index.php -O /usr/local/vesta/web/list/server/index.php

Re: List server info not working

Posted: Tue Apr 26, 2016 10:55 am
by SS88
skurudo wrote:You can try this fix:

Code: Select all

wget https://raw.githubusercontent.com/serghey-rodin/vesta/master/web/list/server/index.php -O /usr/local/vesta/web/list/server/index.php
This worked for me, thank you.

Re: List server info not working

Posted: Tue Apr 26, 2016 11:01 am
by skurudo
Nice, closed

Fix above or link below:
viewtopic.php?f=16&t=11073&p=42934#p42934