Ubuntu 11.10에 로그인 할 때 표시되는 “메모리 사용량”값은 어떻게 계산됩니까?

Ubuntu 11.10 상자에 로그인하면 기본적으로 여러 값이 표시됩니다. 예를 들면 다음과 같습니다.

Welcome to Ubuntu 11.10 (GNU/Linux 3.0.0-17-virtual x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Thu Apr  5 20:35:07 UTC 2012

  System load:  0.01              Processes:           56
  Usage of /:   15.5% of 7.87GB   Users logged in:     0
  Memory usage: 26%               IP address for eth0: XX.XXX.XX.XXX
  Swap usage:   0%

  Graph this data and manage this system at https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest
  http://www.ubuntu.com/business/services/cloud

“메모리 사용”값이 어떻게 계산되는지 알고 싶습니다. 그래서 이것을 수집하고 시간이 지남에 따라 그래프를 작성하는 셸 스크립트를 작성할 수 있습니다.

감사!



답변

motd에 로그인하면의 모든 파일이 실행됩니다 /etc/update-motd.d. 당신이 찾고있는 출력 50-landscape-sysinfo은에서 심볼릭 링크 /usr/share/landscape/landscape-sysinfo.wrapper입니다.

이것은 짧은 스크립트 일뿐입니다.

#!/bin/sh
cores=$(grep -c ^processor /proc/cpuinfo 2>/dev/null)
[ "$cores" -eq "0" ] && cores=1
threshold="${cores:-1}.0"
if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < $threshold" | bc) -eq 1 ]; then
    echo
    echo -n "  System information as of "
    /bin/date
    echo
    /usr/bin/landscape-sysinfo
else
    echo
    echo " System information disabled due to load higher than $threshold"
fi

에서 온 것을 나타냅니다 landscape-sysinfo. 해당 출력은 해당 유틸리티의 STDOUT입니다. 조경 은 모두 정식 시스템 모니터링 서비스의 일부입니다. 자세한 내용은 여기를 참조하십시오.

이것이 충분하지 않으면 Nagious는 더 많은 시스템을 모니터링 할 수있는 고급이지만 무료 네트워킹 모니터링 도구입니다. Cacti는 시스템에 대한 개별 모니터링 인 RRDtool의 그래픽 웹 프론트 엔드입니다.