计算机云计算

使用提供的虚拟机和软件包,完成Raid磁盘阵列的创建。当前虚拟机存储在一个大小为20G的磁盘vdb,利用磁盘分区新建4个磁盘分区,每个大小为5 GB。用3个5 GB的分区来模拟一个名为md5,级别为raid 5,外加一个热备盘的磁盘阵列。创建完成后将mdadm -D /dev/md5的返回结果以文本形式提交到答题框。
参考答案:
[root@localhost ~]# mdadm -D /dev/md5
/dev/md5:
Version : 1.2
Creation Time : Sat Oct 5 13:17:41 2019
Raid Level : raid5
Array Size : 41908224 (39.97 GiB 42.91 GB)
Used Dev Size : 20954112 (19.98 GiB 21.46 GB)
Raid Devices : 3
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Sat Oct 5 13:19:27 2019
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 512K
Consistency Policy : unknown
Name : localhost.localdomain:5 (local to host localhost.localdomain)
UUID : f51467bd:1199242b:bcb73c7c:160d523a
Events : 18
Number Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb
1 8 32 1 active sync /dev/sdc
4 8 48 2 active sync /dev/sdd
3 8 64 - spare /dev/sde

44

使用提供的软件包和提供的虚拟机,完成单节点应用系统部署。部署完成后,进行登录,(订单中填写的收货地址填写
自己学校的地址,收货人填写自己的实际联系方式)最后使用curl命令去获取商城首页的返回信息,将curl http://你自
己的商城IP/#/home获取到的结果以文本形式提交到答题框。

参考答案: [root@server ~]# curl http://172.30.11.27/#/home

1+x-示例项目

ords content="">

<script type=text/javascript src=/static/js/manifest.2d17a
82764acff8145be.js><script type=text/javascript src=/static/js/vendor.4f07d3a235c8a7cd4efe.js

46
(未做:0分)
使用提供的两台虚拟机,在虚拟机上安装mariadb数据库,并配置为主从数据库,实现两个数据库的主从同步。配置完
毕后,请在从节点上的数据库中执行“show slave status \G”命令查询从节点复制状态,将查询到的结果以文本形式提交
到答题框。
考生答案:
参考答案: MariaDB [(none)]> start slave;
MariaDB [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: mysql1
Master_User: user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 245
Relay_Log_File: mariadb-relay-bin.000005
Relay_Log_Pos: 529
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 245
Relay_Log_Space: 1256
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 30
1 row in set (0.00 sec)

使用提供的虚拟机与软件包,基于上一题构建的主从数据库,进一步完成Mycat读写分离数据库的配置安装。需要用的配置文件schema.xml文件如下所示(server.xml文件不再给出): select user() 配置读写分离数据库完毕后,使用netstat -ntpl命令查询端口启动情况。最后将netstat -ntpl命令的返回结果以文本形式提交到答题框。

使用提供的“all-in-one”虚拟机,使用openstack命令,创建一个名称为“alice”账户,密码为“mypassword123”,邮箱为“alice@example.com”。并且创建一个名为“acme”项目。创建一个色“compute-user”。给用户“alice”分配“acme”项目下的“compute-user”角色。将以上操作命令及结果以文本形式填入答题框。
参考答案:
[root@xiandian ~]# source /etc/keystone/admin-openrc.sh
[root@xiandian ~]# openstack user create --password mypassword123 --email alice@example.com --domain domain alice
[root@xiandian ~]# openstack project create --domain domain acme
[root@xiandian ~]# openstack role create compute-user
[root@xiandian ~]# openstack role add --user alice --project acme compute-user

使用提供的“all-in-one”虚拟机,使用Glance命令,创建一个名称为“cirros”镜像,镜像文件使用提供的为“cirros-0.3.4-x86_64-disk.img”。通过glance 命令查看镜像“cirros”的详细信息。使用glance 命令更新镜像信息min-disk(min-disk默认单位为G)为1G。将以上操作命令及结果以文本形式填入答题框。

参考答案:
[root@xiandian images]# glance image-create --name “cirros” --disk-format qcow2 --container-format bare --progress < cirros-0.3.4-x86_64-disk.img

glance image-show id

glance image-update --min-disk=1 id

使用提供的“all-in-one”虚拟机,使用Nova命令,创建一个名为test的安全组,描述为’test the nova command about the rules’。并且使用命令创建一个名为test,ID为6,内存为2048 MB,磁盘为20 GB,vcpu数量为2的云主机类型,查看test云主机类型的详细信息。将以上操作命令及结果以文本形式填入答题框。
考生答案:
参考答案:

nova secgroup-create test ‘test the nova command about the rules’

nova flavor-create test 6 2048 20 2

nova flavor-show test

使用提供的虚拟机和软件包,自行配置YUM源,安装docker-ce服务。安装完毕后执行docker info命令的返回结果以文
本形式提交到答题框。

参考答案:
Containers: 33
Running: 16
Paused: 0
Stopped: 17
Images: 22
Server Version: 18.09.6
Storage Driver: devicemapper
Pool Name: docker-253:0-113162281-pool
Pool Blocksize: 65.54kB
Base Device Size: 10.74GB
Backing Filesystem: xfs
Udev Sync Supported: true
Data file: /dev/loop0
Metadata file: /dev/loop1
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Data Space Used: 3.573GB
Data Space Total: 107.4GB
Data Space Available: 18.72GB
Metadata Space Used: 22.59MB
Metadata Space Total: 2.147GB
Metadata Space Available: 2.125GB
Thin Pool Minimum Free Space: 10.74GB
Deferred Removal Enabled: true
Deferred Deletion Enabled: true
Deferred Deleted Device Count: 0
Library Version: 1.02.158-RHEL7 (2019-05-13)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-1062.7.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.913GiB
Name: master
ID: U4ME:YWV6:WZEK:7R7W:5OLN:MO4A:NVNH:AEPR:L7GE:UD4S:UZOY:GZXQ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
192.168.70.10:5000
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
WARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release.
WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use.
Use --storage-opt dm.thinpooldev to specify a custom block storage device.

使用提供的虚拟机,自行配置好网络,安装好docker-ce。部署Swarm集群,并安装Portainer图形化管理工具,部署完成后,使用浏览器登录ip:9000界面,进入Swarm控制台。将curl swarm ip:9000返回的结果以文本形式提交到答题框。

参考答案: [root@master ~]# curl 192.168.100.10:9000

Portainer
Loading Portainer...

使用提供的虚拟机和软件包,安装docker compose服务,安装完毕后,使用命令查看docker compose的版本信息,将
查询版本信息的命令与返回结果已文本形式提交到答题框。
考生答案:
参考答案:
[root@compose ~]# docker-compose --version
docker-compose version 1.25.0-rc2, build 661ac20e

使用提供的虚拟机和软件包,搭建Kubernetes平台,平台的两个节点分别为master和node节点,在将node节点加入到集群后,登录master节点,使用kubectl get nodes查询各节点状态。将查询节点状态的返回结果以文本形式提交到答题
框。
参考答案:
[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready master 117m v1.14.1
node Ready 6m30s v1.14.1

下面有一段脚本,作用是自动配置nginx服务,由于工程师的失误,将脚本中的某些代码删除了,但注释还在,请根据注释,填写代码。最后将填写的代码按照顺序以文本形式提交至答题框。

nginx(){
cd
#删除默认项目路径下的文件
rm -rf /usr/share/nginx/html/*
#将提供的dist静态文件复制到nginx项目目录
cp -rvf /root/dist/* /usr/share/nginx/html
#修改nginx配置文件如下
cat > /etc/nginx/conf.d/default.conf << EOF
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /user {
(此处需要填写)
}
location /shopping {
proxy_pass http://127.0.0.1:8081;
}
location /cashier {
proxy_pass http://127.0.0.1:8083;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
EOF
#启动nginx服务
systemctl start nginx
#设置nginx开机自启
(此处需填写)
#检查nginx服务是否成功启动
if [ $? -eq 0 ]
then
sleep 3
echo -e “\033[36mnginx启动成功\033[0m”
else
echo -e “\033[31mnginx启动失败,请检查\033[0m”
exit 1
fi
sleep 2
}

使用提供的虚拟机和软件包,完成KVM服务的安装与KVM虚拟机的启动。使用提供的cirros镜像与qemu-ifup-NAT脚本启动虚拟机,启动完毕后登录,登录有执行ip addr list命令,将该命令的返回结果一文本形式提交到答题框。
参考答案:
$ ip addr list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.89/24 brd 192.168.122.255 scope global eth0
inet6 fe80::5054:ff:fe12:3456/64 scope link
valid_lft forever preferred_lft forever

继续使用上题的三台虚拟机,使用提供的软件包,完成Zookeeper集群的安装与配置,配置完成后,在相应的目录使用./zkServer.sh status命令查看三个Zookeeper节点的状态,将三个节点的状态以文本形式提交到答题框。
参考答案: [root@zookeeper1 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /root/zookeeper-3.4.14/bin/…/conf/zoo.cfg
Mode: follower
[root@zookeeper2 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /root/zookeeper-3.4.14/bin/…/conf/zoo.cfg
Mode: leader
[root@zookeeper3 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /root/zookeeper-3.4.14/bin/…/conf/zoo.cfg
Mode: follower

继续使用上题的三台虚拟机,使用提供软件包,完成Kafka集群的安装与配置,配置完成后,在相应的目录使用./kafka-topics.sh --create --zookeeper 你的IP:2181 --replication-factor 1 --partitions 1 --topic test创建topic,将输入命令后的返回结果以文本形式提交到答题框。
参考答案:
[root@zookeeper1 bin]# ./kafka-topics.sh --create --zookeeper 172.16.51.23:2181 --replication-factor 1 --partitions 1 --topic test
Created topic “test”.

继续使用上题的三台虚拟机,使用提供的软件包,基于集群应用系统部署。部署完成后,进行登录,(订单中填写的收货地址填写自己学校的地址,收货人填写自己的实际联系方式)最后使用curl命令去获取商城首页的返回信息,将curl http://你自己的商城IP/#/home获取到的结果以文本形式提交到答题框
参考答案:
[root@server ~]# curl http://172.30.11.27/#/home

1+x-示例项目

ords content="">

<script type=text/javascript src=/static/js/manifest.2d17a
82764acff8145be.js><script type=text/javascript src=/static/js/vendor.4f07d3a235c8a7cd4efe.js

使用提供的“all-in-one”虚拟机,使用Neutron命令,查询网络服务的列表信息中的“binary”一列,并且查询网络sharednet1详细信息。然后查询网络服务DHCP agent的详细信息。将以上操作命令及结果以文本形式填入答题框。
考生答案:
参考答案: [root@xiandian ~]# neutron agent-list -c binary
±--------------------------+
| binary |
±--------------------------+
| neutron-l3-agent |
| neutron-openvswitch-agent |
| neutron-dhcp-agent |
| neutron-metadata-agent |
±--------------------------+
[root@xiandian ~]# neutron net-list
±-------------------------------------±-----------±--------+
| id | name | subnets |
±-------------------------------------±-----------±--------+
| bd923693-d9b1-4094-bd5b-22a038c44827 | sharednet1 | |
±-------------------------------------±-----------±--------+

neutron net-show bd923693-d9b1-4094-bd5b-22a038c44827

±--------------------------±-------------------------------------+
| Field | Value |
±--------------------------±-------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2017-02-23T04:58:17 |
| description | |
| id | bd923693-d9b1-4094-bd5b-22a038c44827 |
| ipv4_address_scope | |
| ipv6_address_scope | |
| mtu | 1500 |
| name | sharednet1 |
| port_security_enabled | True |
| provider:network_type | flat |
| provider:physical_network | physnet1 |
| provider:segmentation_id | |
| router:external | False |
| shared | True |
| status | ACTIVE |
| subnets | |
| tags | |
| tenant_id | 20b1ab08ea644670addb52f6d2f2ed61 |
| updated_at | 2017-02-23T04:58:17 |
±--------------------------±-------------------------------------+
[root@xiandian ~]# neutron agent-list
±----------±---------------±---------±------------------±------±------------------±-------------+
| id | agent_type | host | availability_zone | alive | admin_state_up | binary |
±----------±---------------±---------±------------------±------±------------------±-------------+
| 7dd3ea38-c6fc-4a73-a530-8b007afeb778 | L3 agent | xiandian | nova | 😃 | True | neutron-l3-agent |
| 8c0781e7-8b3e-4c9f-a8da-0d4cdc570afb | Open vSwitch agent | xiandian | | 😃 | True | neutron-openvsw
itch-agent |
| a3504292-e108-4ad1-ae86-42ca9ccfde78 | DHCP agent | xiandian | nova | 😃 | True | neutron-dhcp-agen
t |
| be17aa73-deba-411a-ac10-fd523079085d | Metadata agent | xiandian | | 😃 | True | neutron-metadata-a
gent |
±----------±---------------±---------±------------------±------±------------------±-------------+
[root@xiandian ~]# neutron agent-show a3504292-e108-4ad1-ae86-42ca9ccfde78
±--------------------±---------------------------------------------------------+
| Field | Value |
±--------------------±---------------------------------------------------------+
| admin_state_up | True |
| agent_type | DHCP agent |
| alive | True |
| availability_zone | nova |
| binary | neutron-dhcp-agent |
| configurations | { |
| | “subnets”: 1, |
| | “dhcp_lease_duration”: 86400, |
| | “dhcp_driver”: “neutron.agent.linux.dhcp.Dnsmasq”, |
| | “networks”: 1, |
| | “log_agent_heartbeats”: false, |
| | “ports”: 2 |
| | } |
| created_at | 2017-02-23 04:57:05 |
| description | |
| heartbeat_timestamp | 2019-09-28 21:33:06 |
| host | xiandian |
| id | a3504292-e108-4ad1-ae86-42ca9ccfde78 |
| started_at | 2017-02-23 04:57:05 |
| topic | dhcp_agent |
±--------------------±---------------------------------------------------------+

使用提供的“all-in-one”虚拟机,使用Cinder命令,创建一个2 GB的云硬盘extend-demo,并且查看云硬盘信息,创建了一个名为“lvm”的卷类型。通过cinder命令查看现有的卷类型。创建一块带“lvm”标识名为type_test_demo的云硬盘,最后使用命令查看所创建的云硬盘。将以上操作命令及结果以文本形式填入答题框。
考生答案:
参考答案:

cinder create --name cinder-volume-demo 2

cinder list

cinder type-create lvm

cinder type-list

cinder create --name type_test_demo --volume-type lvm 1

cinder show type_test_demo

使用提供的“all-in-one”虚拟机,使用openstack命令,创建名为examtest的容器并查询,上传一个aaa.txt(可自行创建)文件到这个容器中并查询。依次将操作命令和返回结果以文本形式提交到答题框。
考生答案:
参考答案:
[root@xiandian ~]# openstack container create examtest
±--------------------------------------±----------±-----------------------------------+
| account | container | x-trans-id |
±--------------------------------------±----------±-----------------------------------+
| AUTH_0ab2dbde4f754b699e22461426cd0774 | examtest | tx9e7b54f8042d4a6ca5ccf-005a93daf3 |
±--------------------------------------±----------±-----------------------------------+
[root@xiandian ~]# openstack container list
±---------+
| Name |
±---------+
| examtest |
±---------+
[root@xiandian ~]# openstack object create examtest aaa.txt
±--------±----------±---------------------------------+
| object | container | etag |
±--------±----------±---------------------------------+
| aaa.txt | examtest | 45226aa24b72ce0ccc4ff73eefe2e26f |
±--------±----------±---------------------------------+
[root@xiandian ~]# openstack object list examtest
±--------+
| Name |
±--------+
| aaa.txt |
±--------+

登录“all-in-one”云主机。使用ceilometer相关命令,查询测量值的列表信息。依次将操作命令及返回结果以文本形式提交到答题框。
参考答案:
[root@xiandian ~]# ceilometer meter-list

使用提供的虚拟机与软件包,部署Docker Harbor镜像仓库服务。安装完毕后,将执行./install.sh --with-notary --withclair命令返回结果中的[step4]的内容以文本形式提交到答题框。
考生答案:
参考答案:
[Step 4]: starting Harbor …
✔ ----Harbor has been installed and started successfully.----
Now you should be able to visit the admin portal at https://10.24.2.37.
For more details, please visit https://github.com/vmware/harbor .

自定义Dockerfile,要求Dockerfile主要完成以下工作: ①构建一个基于Python 3.5的镜像。 ②把当前目录添加到镜像中的/code路径下。 ③把工作路径设置成/code。 ④设置容器的默认命令为python app.py。 将Dockerfile文件以文本形
式提交到答题框。

参考答案:
FROM python:3.5-alpine
ADD . /code
WORKDIR /code
CMD [“python”, “app.py”]

下面有一段Python脚本,由于工程师的失误,将脚本中的某些代码删除了,但注释还在,请根据注释,填写代码。最后将填写的代码按照顺序以文本形式提交至答题框。 Python脚本如下: def get_html(url, encoding=‘utf-8’): # 定义headers headers = { ‘User-Agent’: ‘Mozilla/5.0 (Windows NT 6.1;WOW64) AppleWebKit/537.36 (KHTML, likeGecko)Chrome/67.0.3396.99 Safari/537.36’ } # 调用requests依赖包的get方法,请求该网址,返回response (此处需填写) #设置response字符为utf-8 (此处需填写) # 返回response的文本 return response.text
考生答案:
参考答案:
response = requests.get(url, headers=headers)
response.encoding = encoding

登录“all-in-one”云主机,使用命令查看当前卷组信息,使用lvcreate命令,创建名称为BlockVloume,大小为2G的lvm
逻辑卷,查询该逻辑卷详细信息,依次将操作命令及返回结果以文本形式提交到答题框。
考生答案:
参考答案: [root@xiandian ~]# vgs
VG #PV #LV #SN Attr VSize VFree
cinder-volumes 1 0 0 wz–n- 4.75g 4.75g
[root@xiandian ~]# lvcreate -L +2G -n BlockVolume cinder-volumes
Logical volume “BlockVolume” created.
[root@xiandian ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
BlockVolume cinder-volumes -wi-a----- 2.00g
[root@xiandian ~]# lvdisplay
— Logical volume —
LV Path /dev/cinder-volumes/BlockVolume
LV Name BlockVolume
VG Name cinder-volumes
LV UUID qv2rgN-k5EQ-3gL7-nx5j-sx32-EeHk-wPrMaK
LV Write Access read/write
LV Creation host, time xiandian, 2018-01-18 03:22:26 +0000
LV Status available

open 0

LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto

  • currently set to 8192
    Block device 252:0

登录“all-in-one”云主机。使用swift相关命令,查询swift对象存储服务可以存储的单个文件大小的最大值,依次将操作
命令及返回结果以文本形式提交到答题框。
考生答案:
参考答案: [root@xiandian ~]# swift capabilities |grep max_file_size
max_file_size: 5368709122

Zabbix-server节点搭建(40分)
使用提供的三台虚拟机和软件包,完成Zookeeper集群的安装与配置,配置完成后,在相应的目录使用./zkServer.sh
status命令查看三个Zookeeper节点的状态,将三个节点的状态以文本形式提交到答题框。
考生答案:
参考答案: [root@zookeeper1 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /root/zookeeper-3.4.14/bin/…/conf/zoo.cfg
Mode: follower
[root@zookeeper2 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /root/zookeeper-3.4.14/bin/…/conf/zoo.cfg
Mode: leader
[root@zookeeper3 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /root/zookeeper-3.4.14/bin/…/conf/zoo.cfg
Mode: follower
老师评分:0分
教师点评:
此题还没有任何教师进行点评~
47
(未做:0分)
使用提供的三台虚拟机和软件包,完成Kafka集群的安装与配置,配置完成后,在相应的目录使用 ./kafka-topics.sh –
create --zookeeper 你的IP:2181 --replication-factor 1 --partitions 1 --topic test创建topic,将输入命令后的返回结果以
文本形式提交到答题框。
考生答案:
参考答案: [root@zookeeper1 bin]# ./kafka-topics.sh --create --zookeeper 172.16.51.23:2181 --replication-factor 1 -
-partitions 1 --topic test
Created topic “test”.
老师评分:0分
教师点评:
此题还没有任何教师进行点评~
48
(未做:0分)
使用提供的虚拟机和软件包,完成Zabbix监控系统server端的搭建,搭建完毕后启动服务,然后使用netstat -ntpl命令
查看端口启动情况,将netstat -ntpl命令的返回结果以文本形式提交到答题框。
考生答案:
参考答案:
[root@zabbix-server ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 10611/zabbix_server
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 10510/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 975/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 886/master
tcp6 0 0 :::10051 ::😗 LISTEN 10611/zabbix_server
tcp6 0 0 :::80 ::😗 LISTEN 10579/httpd
tcp6 0 0 :::80 ::: LISTEN 10579/httpd
tcp6 0 0 :::21 ::😗 LISTEN 10015/vsftpd
tcp6 0 0 :::22 ::😗 LISTEN 975/sshd
tcp6 0 0 ::1:25 ::😗 LISTEN 886/master

shell
#!/bin/bash

BEGINCOLOR="\e[1;35m"

ENDCOLOR="\e[0m"

echo -e “My hostname is B E G I N C O L O R ‘ h o s t n a m e ‘ {BEGINCOLOR}`hostname` BEGINCOLORhostnameENDCOLOR”

echo -e “IP address is KaTeX parse error: Can't use function '\.' in math mode at position 51: …Eo '([0-9]{1,3}\̲.̲){3}[0-9]{1,3}'…ENDCOLOR”

echo -e “OS version is B E G I N C O L O R ‘ c a t / e t c / r e d h a t − r e l e a s e ‘ {BEGINCOLOR}`cat /etc/redhat-release` BEGINCOLORcat/etc/redhatreleaseENDCOLOR”

echo -e “Kernel version is B E G I N C O L O R ‘ u n a m e − r ‘ {BEGINCOLOR}`uname -r` BEGINCOLORunamerENDCOLOR”

echo -e “CPU type is B E G I N C O L O R ‘ l s c p u ∣ g r e p " M o d e l n a m e " ∣ c u t − d : − f 2 ∣ t r − s " " ‘ {BEGINCOLOR}`lscpu|grep "Model name" |cut -d: -f2 |tr -s " "` BEGINCOLORlscpugrep"Modelname"cutd:f2trs""ENDCOLOR”

echo -e “Memtotol is B E G I N C O L O R ‘ c a t / p r o c / m e m i n f o ∣ h e a d − n 1 ∣ g r e p − E o ′ [ 0 − 9 ] + . ∗ ′ ‘ {BEGINCOLOR}`cat /proc/meminfo |head -n1 |grep -Eo '[0-9]+.*'` BEGINCOLORcat/proc/meminfoheadn1grepEo[09]+.ENDCOLOR”

echo -e “Disk space is B E G I N C O L O R ‘ l s b l k ∣ g r e p ′ s d a   ′ ∣ g r e p − E o ′ [ 0 − 9 ] + [ [ : u p p e r : ] ] ′ ‘ {BEGINCOLOR}`lsblk |grep 'sda\>'|grep -Eo '[0-9]+[[:upper:]]'` BEGINCOLORlsblkgrepsdagrepEo[09]+[[:upper:]]ENDCOLOR”

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值