SSH를 통해 CPU 사용률을 검색하고 "top"명령을 시도했지만이를 허용하지 않습니다.SSH를 통한 CPU 사용량 얻기
나는이 코드
$connection = ssh2_connect("IP", PORT);
ssh2_auth_password($connection, "root", "PASS");
$stream = ssh2_exec($connection, "top");
$errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
// Enable blocking for both streams
stream_set_blocking($errorStream, true);
stream_set_blocking($stream, true);
// Whichever of the two below commands is listed first will receive its appropriate output. The second command receives nothing
echo "Output: " . stream_get_contents($stream);
echo "Error: " . stream_get_contents($errorStream);
// Close the streams
fclose($errorStream);
fclose($stream);
을 시도하지만 그 때마다 나에게 오류 줄에 CentOS 6
을 사용하고 있습니다 : 출력 : 오류 : TERM 환경 변수 설정되지 않았습니다.
나는 PHP를 사용하고 있습니다.
당신은 아마 어떤 수단 "그것은 나를 못하게"에 대한 몇 가지 세부 사항을 제공해야합니다 ... 오류 메시지 또는 무언가처럼 ... – TypeIA
프로그래밍 관련이 있습니까? 아니면 일반적인 OS 질문입니까? –
이것이 일반적인 운영 체제 질문이고 프로그래밍과 직접 관련이없는 경우 수퍼 유저 또는 서버 오류와 같은 다른 스택 Exchange 사이트에 더 적합합니다. 해당 사이트의 목적을 검토하고 질문에 가장 적합한 것을 결정하십시오. – dthree