-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc71f68
commit d0fd87c
Showing
5 changed files
with
143 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
## 扫描系统信息 | ||
|
||
**版本支持:** | ||
|
||
- [v0.7.18-alpha以上](https://github.com/weiliang-ms/easyctl/releases/) | ||
|
||
**兼容性:** | ||
|
||
- [x] `CentOS6` | ||
- [x] `CentOS7` | ||
|
||
**扫描内容:** | ||
|
||
- 基本信息: | ||
- `IP`地址 | ||
- 主机名 | ||
- 系统版本 | ||
- 内核版本 | ||
- `CPU`信息 | ||
- `CPU`线程数(逻辑核数) | ||
- `CPU`主频 | ||
- `CPU`型号 | ||
- `CPU`平均负载 | ||
- 内存信息 | ||
- 总内存大小 | ||
- 已用内存大小 | ||
- 内存使用率 | ||
- 磁盘信息 | ||
- 系统盘名称 | ||
- 根分区使用率 | ||
- 使用率超过`90%`的分区 | ||
|
||
### 使用方式 | ||
|
||
> 参考以下链接进行安装 | ||
- [安装说明文档](../-安装文档/README.md) | ||
|
||
> 生成默认配置文件 | ||
```shell | ||
$ easyctl scan os | ||
INFO[0000] 生成配置文件样例, 请携带 -c 参数重新执行 -> config.yaml | ||
``` | ||
|
||
> 修改配置文件 | ||
`config.yaml`, 修改主机列表。`easyctl`根据主机列表`ssh`远程至目标主机进行扫描 | ||
|
||
```yaml | ||
server: | ||
- host: 10.10.10.[1:3] | ||
username: root | ||
privateKeyPath: "" # ~/.ssh/id_rsa,为空默认走password登录;不为空默认走密钥登录 | ||
password: 123456 | ||
port: 22 | ||
excludes: | ||
- 192.168.235.132 | ||
``` | ||
> 执行 | ||
添加`--debug`可以输出详细内容。 | ||
|
||
```shell | ||
$ easyctl scan os -c config.yaml --debug | ||
``` | ||
|
||
### 配置项说明 | ||
|
||
- 主机配置段:该段配置远程执行`shell`的主机信息,字段说明如下 | ||
- `host: 10.10.10.[1:3]` 主机地址段,适用于`ip`连续场景。分隔符可以为`[1:3]`、`1-2`、`[1-2]`、`1:2` | ||
- `username`: 远程主机`ssh`用户名称,缺省值为`root` | ||
- `password`: 对应`username`的密码 | ||
- `privateKeyPath`: `ssh`私钥路径 | ||
- `port`: `ssh`端口,默认`22` | ||
- `excludes`: 排除`host`地址段内的`ip`地址列表 | ||
|
||
`privateKeyPath`优先级高于`password`: | ||
|
||
1. `privateKeyPath`为空,取`password`值,`ssh`使用密码登录方式 | ||
2. `privateKeyPath`非空,取`privateKeyPath`值,`ssh`使用密钥登录方式 | ||
|
||
```yaml | ||
server: | ||
- host: 10.10.10.[1:3] | ||
username: root | ||
privateKeyPath: ~/.ssh/id_rsa | ||
password: "" | ||
port: 22 | ||
excludes: | ||
- 192.168.235.132 | ||
``` | ||
|
||
### 配置样例 | ||
|
||
> 1.扫描主机: `10.10.10.1-10.10.10.10`信息 | ||
|
||
```yaml | ||
server: | ||
- host: 10.10.10.[1:10] | ||
username: root | ||
privateKeyPath: ~/.ssh/id_rsa | ||
password: "" | ||
port: 22 | ||
excludes: | ||
- 192.168.235.132 | ||
``` | ||
|
||
> 2.扫描主机: `10.10.10.1`、`10.10.10.3`、`10.10.10.4`信息,使用密码登录方式 | ||
|
||
```yaml | ||
server: | ||
- host: 10.10.10.[1:4] | ||
username: root | ||
# privateKeyPath: ~/.ssh/id_rsa | ||
password: "123456" | ||
port: 22 | ||
excludes: | ||
- 10.10.10.2 | ||
``` | ||
|
||
### 扫描样例 | ||
|
||
执行完扫描指令后,会生成`system.xlsx`文件,内容大致如下: | ||
|
||
![](images/scan-os-result.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters