您的位置:首页 > 博客中心 > 数据库 >

[翻译]mongodb日志分析工具mtools之mplotqueries

时间:2022-03-14 03:06

mtools是一组非常好用的mongodb日志分析工具,里面最复杂的命令是mplotqueries,上网查了一下,还没有人翻译过。英文不好,费了好大的劲翻完,翻的不好,但没有办法,我英文水平就这么多~

-----------------------------------------------------------------------------------------------------------------------

mplotqueries

Thomas Rueckstiess edited this page on 9 Oct · 

mplotqueries is a tool to visualize operations in MongoDB logfiles. It has several different plot types and can group information in various ways.

把MongoDB操作形象化的工具。它有多种类型的图表支持多种方式对信息分组。

Usage(使用说明)

mplotqueries [-h] [--version] logfile [logfile ...]               [--group GROUP]               [--logscale]               [--type {nscanned/n,rsstate,connchurn,histogram,range,scatter,event} ]               [--overlay [ {add,list,reset} ]]               [additional plot type parameters]

mplotqueries can also be used with shell pipe syntax, for example:

可以在命令行管道语法中使用,例如

mlogfilter logfile [parameters] | mplotqueries --type histogram

General Parameters(全局参数)

Help(帮助)
-h, --help 

shows the help text and exits.

显示帮助信息并退出

Version(版本)
--version 

shows the version number and exits.

显示版本信息并退出

Logarithmic Scale (对数模式)

--logscale 
 This option enables the logarithmic scale for plots where this makes sense. This is very useful if the plot contains outliers that squash all other data points to the bottom of the graph (see below comparison on the same data between log scale disabled and enabled). It can also be enabled with the l (lowercase L) shortcut once a plot is rendered. Switching scale on an already rendered plot may take a few seconds before the new scale is shown.

这个选项允许在图表中使用对数模式。如果图表中的数据分化严重,所有的点都被压到图的底部时,它非常有用(参见下面的比较,相同的数据在使用对数模式和不使用时的区别)。

它可以在渲染图表时用l (小l)来启用。在已经渲染好的图表中切换显示模式,需要花比较长的时间才能显示出来。


gxlsystem.com,布布扣

Available Groupings (有效分组)

No groupings are supported by this type of plot.

此图不支持分组。

Additional Parameters (附加参数)

No additional parameters are supported by this type of plot.

此图不支持附加参数。


Overlays (组合)

The overlay mechanism allows you to overlay several plot types in one graphic. This is useful to see correlations, match information from different plot types and create graphs that show events from different angles.

组合机制允许把多个图合并成一个图。这在查看统计的时候很有用,从多个图中匹配信息并在多个角度显示信息。

Each of the plot types can in theory be used as an overlay, however some of them make more sense then others.

理论上每种图都可以用于组合,无论哪个图表显得更加突出。

Overlays are created just as normal plots, except they are stored on disk and do not render immediately. The first call to mplotqueries that does not add another overlay then will load all existing overlays added previously and render them on top of each other, matching the time axis.

组合只能创建标准图像,除非它们已经被储存并且非直接渲染。第一次调用mplotqueries不会添加其他图像的组合,还需要加载所有已经存在的图并一层层地渲染,用时间轴来匹配。

Overlays are stored globally and are persistent, independent of your current working directory. Therefore, if you no longer need to store added overlays, make sure that you remove them again or they will be added to your next call of mplotqueries.

组合对当前目录来说是全局存储的,并且稳定的,不依赖的。因此,因此如果不再需要存储组合图,请确认它们已经被删除了,否则它会在下次运行mplotqueries时被添加进去。

Plot types that are often used for overlays are: event, range, rsstate, and scatter.

常用于组合的图有:事件图,区域图,副本集状态图,散点图。

Creating Overlays (创建组合图)

--overlay [add] 

To create an overlay, run mplotqueries as you would normally, with all the command line arguments. In addition, specify the --overlay add argument. As add is the default for overlays, it can be omitted.

创建一个组合图,除正常使用 mplotqueries 命令和所有参数外,需要特别指定 --overlay add 参数。add 是组合的默认参数,可以省略。 

Example (示例)
mplotqueries mongod.log --type scatter --overlay    Created overlay: 18124963

This will add an overlay plot. The plot is not shown but saved on disk instead, and rendered with the next call without --overlay.

此命令会添加一个组合图。这个图不会被显示出来而是被存储在磁盘上,并且在下次不带 --overlay 参数时被渲染。

List Existing Overlays (已存在的组合列表)

--overlay list 

To see if overlays are currently existing, you can use this command. A list of existing overlay identifiers will be returned. Currently, the indentifiers are not all that useful by themselves, but the command will show you how many different overlays exist.

查看组合是不是已经存在,可以使用这个命令。它会返回一个已经存在的组合的id列表。这时,这些标识并不是全部被使用,这个命令只是显示有多少不同的组合存在。


Remove Overlays (删除组合)

--overlay reset 

To remove all overlays, you can use this command. It will delete all existing overlays, and the next (or current, if a log file is specified as well) call to mplotqueries will not show additional overlays anymore.

使用这个命令删除所有的组合。它会删除所有已经存在的组合,然后(或现在,如果日志文件已经被指定好了)调用mplotqueries 命令就不会显示添加过的组合了。



热门排行

今日推荐

热门手游