Allandersson Paulo Posted February 11, 2014 Share Posted February 11, 2014 Galera, eu Quero mostrar no meu WHMCS o Uptime do meu servidor de TeamSpeak 3, Exixte alguma coisa que eu consiga fazer isso pois eu não trabalho nele com cpanel, whm, nada disso o WHMCS teria que entrar no meu servidor e coletar o uptime. Link to comment Share on other sites More sharing options...
fernandoguga Posted February 12, 2014 Share Posted February 12, 2014 você pode fazer usando php SSH2 para conectar ao servidor e pegar o uptime. Link to comment Share on other sites More sharing options...
Allandersson Paulo Posted February 12, 2014 Author Share Posted February 12, 2014 Como faço isso? Enviado de meu GT-I8190L usando Tapatalk Link to comment Share on other sites More sharing options...
fernandoguga Posted February 12, 2014 Share Posted February 12, 2014 Como faço isso? Enviado de meu GT-I8190L usando Tapatalk depende de onde e como que mostrar essa informação para adaptar ao whmcs. Mas conectar com o servidor usando PHP é relativamente facil. Segue um exemplo. <?php $server = "serverB.example.org"; //hostname ou IP //specify your username $username = "root"; //select port to use for SSH $port = "22"; //command that will be run on server B $command = "uptime"; //form full command with ssh and command, you will need to use links above for auto authentication help $cmd_string = "ssh -p ".$port." ".$username."@".$server." ".$command; //this will run the above command on server A (localhost of the php file) exec($cmd_string, $output); //return the output to the browser //This will output the uptime for server B on page on server A echo '<pre>'; print_r($output); echo '</pre>'; ?> 1 Link to comment Share on other sites More sharing options...
LeandroTC Posted February 13, 2014 Share Posted February 13, 2014 Bacana esse script @fernandoguga. Vou fazer um teste depois. Abraços! :) Link to comment Share on other sites More sharing options...
Recommended Posts