Ⅰ Centos7 atop使用简述
最近有个centos 7的实例云盘读写BPS偶尔会比较高,想知道是什么进程导致的,首先分析了一下/var/log/messages日志文件,也没有发现什么有用的信息,在运维同事的建议下在实例上安装了atop来监控一下系统资源和进程。
执行 yum install -y atop 命令进行安装
安装完成之后就可以直接使用 atop 命令了,详细的用法网上一大堆就不赘述了,或点击文章底部的参考链接查看。
关于监控内容采集和生成日志文件,网上内容也很多,使用方法也不尽相同,此处是我自己的实践。安装完成后,在系统内增加了如下目录/文件:
安装完成后,虽然可以使用atop命令查看系统当前的资源情况和运行的进程,但不会在 /var/log/atop 目录下生成日志,执行 systemctl start atop 启动进程才会生成日志文件,日志的名称格式是:atop_xxxxxx,xxxxxx是启动atop服务的当天的时间,如: atop_20220101 。
一定注意这个xxxxxx是服务启动的时间,不是日志记录的时间,默认情况所有的日志都会记录在atop_xxxxxx这一个文件中,不会根据天产生不同的日志文件,比如:是在 2022-01-01 这天执行 systemctl start atop ,那么在 /var/log/atop 文件夹下生成的日志文件就是: atop_20220101 , 2022-01-01 往后的日志都会存储在 atop_20220101 这个日志文件中,而不会产生一个名称为 atop_20220102 的日志文件
所以,如果想每天生成一个日志文件,一个简单的办法是写一个crontab任务每天重启一下atop服务
Ⅱ <a href="index.jsp" class="atop">后面的class是什么意思
class 是类,用来定义 style 属性。
在使用 CSS(样式表)时用 class 可以更方便。
举例:
文件1:C1.CSS
.Bar
{
border-right: 2px outset;
border-top: 2px outset;
overflow: auto;
border-left: 2px outset;
border-bottom: 2px outset;
}
.BCap
{
color: graytext;
}
.BDroper
{
border-right: 2px outset;
border-top: 2px outset;
border-left: 2px outset;
width: 1px;
cursor: move;
border-bottom: 2px outset;
position: static;
height: 100%;
}
这个文件定义了三个类(class):
Bar 工具栏的样式
BCap 工具栏标题的样式
BDroper 工具栏拖动按钮的样式
文件2:Main.HTM (HTML)
<HTML>
<HEAD>
<LINK href="C1.CSS" type=text/css rel=stylesheet> <!--样式表的路径-->
</HEAD>
<BODY>
<DIV class="Bar">
<a class="BDroper"></a>
<a class="BDroper"></a>
<a class="BCap">浏览</a>
<a href="javascript:history.back(1)">返回</a>
<a href="javascript:history.forward(1)">前进</a>
</DIV>
<BODY>
</HTML>
如果不是用样式表,文件2的内容如下:
<HTML>
<HEAD>
<!--没有样式表-->
</HEAD>
<BODY>
<DIV style="border-right: 2px outset; border-top: 2px outset; overflow: auto; border-left: 2px outset; border-bottom: 2px outset;">
<a style="border-right: 2px outset; border-top: 2px outset; border-left: 2px outset; width: 1px; cursor: move; border-bottom: 2px outset; position: static; height: 100%;"></a>
<a style="border-right: 2px outset; border-top: 2px outset; border-left: 2px outset; width: 1px; cursor: move; border-bottom: 2px outset; position: static; height: 100%;"></a>
<a style="color: graytext;">浏览</a>
<a href="javascript:history.back(1)">返回</a>
<a href="javascript:history.forward(1)">前进</a>
</DIV>
<BODY>
</HTML>
可见,如果使用样式表以及 class 属性,则对于样式的定义就能简单的多。
<a href="index.jsp" class="atop">
这定义了一个超链接,它的类为 atop。如果你能找到这个网页的样式表,你会找到这个类的定义。也许是这样的:
.atop
{
.....
}
当然,一个网页也可以使用多个样式表:
...
<HEAD>
<LINK href="C1.CSS" type=text/css rel=stylesheet> <!--样式表1的路径-->
<LINK href="..\C2.CSS" type=text/css rel=stylesheet> <!--样式表2的路径-->
<LINK href="DD1\S1\Main.CSS" type=text/css rel=stylesheet> <!--样式表3的路径-->
</HEAD>
...