如何显示 EC2 实例摘要报告?

如何显示 EC2 实例摘要报告?

通过 SSH 连接到 EC2 实例后,我得到了一份很好的摘要报告 - 如下所示。是否可以使用命令显示此报告?

➜  ~ ssh ...
Warning: the ECDSA host key for 'example.net' differs from the key for the IP address '12.34.56.78'
Offending key for IP in /home/user/.ssh/known_hosts:30
Matching host key in /home/user/.ssh/known_hosts:66
Are you sure you want to continue connecting (yes/no)? yes
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-59-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Feb  6 10:03:28 UTC 2017

  System load:  0.66               Processes:           155
  Usage of /:   43.0% of 49.08GB   Users logged in:     0
  Memory usage: 1%                 IP address for eth0: 172.12.34.56
  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

10 packages can be updated.
10 updates are security updates.


*** System restart required ***
Last login: Mon Feb  6 09:20:51 2017 from 31.19.89.2
ubuntu@ip-172-12-34-56:~$ 

答案1

据我所知,“报告”是 Ubuntu 特定于传统 MOTD(每日消息)登录消息的动态版本,该消息由update-motd

您可以通过阅读文件轻松访问该报告/var/run/motd

来自手册:

UNIX/Linux 系统管理员通常通过维护文件中的文本向控制台和远程用户传达重要信息 /etc/motd,该文本由 pam_motd(8) 模块在交互式 shell 登录时显示。

传统上,此文件是静态文本,通常由发行版安装并且仅在版本升级时更新,或由本地管理员用相关信息覆盖。

Ubuntu 引入了 update-motd 框架,通过该框架,motd(5) 在登录时由一组脚本动态组装而成。

中的可执行脚本/etc/update-motd.d/*由 pam_motd(8) 以 root 用户身份在每次登录时执行,并且此信息连接在 中 /var/run/motd

答案2

是的,这是可能的。实际上有一些脚本。下面的脚本显示系统信息,如负载、内存、交换等

/usr/share/landscape/landscape-sysinfo.wrapper

其他脚本可以在以下位置找到:

/etc/update-motd.d

以下是完整列表:

4 -rwxr-xr-x   1 root root 1220 Feb 20  2014 00-header
4 -rwxr-xr-x   1 root root 1358 Feb 20  2014 10-help-text
0 lrwxrwxrwx   1 root root   46 Jan 14  2016 50-landscape-sysinfo -> /usr/share/landscape/landscape-sysinfo.wrapper
4 -rwxr-xr-x   1 root root  334 Jan 14  2016 51-cloudguest
4 -rwxr-xr-x   1 root root  149 Aug 22  2011 90-updates-available
4 -rwxr-xr-x   1 root root  299 Nov 13  2014 91-release-upgrade
4 -rwxr-xr-x   1 root root  129 Aug  5  2016 95-hwe-eol
4 -rwxr-xr-x   1 root root  111 Jun  3  2015 97-overlayroot
4 -rwxr-xr-x   1 root root  142 Aug 22  2011 98-fsck-at-reboot
4 -rwxr-xr-x   1 root root  144 Aug 22  2011 98-reboot-required

相关内容