简体   繁体   English

从munin数据中删除一个样本

[英]Drop a single sample from munin data

I'm using munin to monitor a postgresql database and I made a 1 time change that caused munin to get a bad sammple (queries per second many orders of magnitude out of the normal range) that is screwing up my graphs. 我正在使用munin监视postgresql数据库,我做了一次更改,导致munin得到一个糟糕的声音(每秒查询超出正常范围的许多数量级),这搞砸了我的图形。 Is there any way I can easily delete a single data point from the munin data? 有什么方法可以轻松地从munin数据中删除单个数据点吗?

I guess I need an rrd editor of some kind, but I'm not sure what will be easiest. 我想我需要某种rrd编辑器,但我不确定什么是最简单的。 Annoying that the data isn't just stored in plaintext :( 恼人的是,数据不只是以明文存储:(

Presuming you're running Linux, it goes something like this: 假设您正在运行Linux,它会是这样的:

$ # 1) Stop the cron job from running
$ sudo mv /etc/cron.d/munin /tmp/munin-cron-job
$ # 2) Run as munin account
$ sudo su - munin
$ # 3) Wait a minute, else run this to make sure any
$ #    background munin-cron is finished
$ munin-cron
$ # 4) Export data file to XML
$ rrdtool dump \
>      /var/lib/munin/example.com/www.example.com-$PLUGIN-d.rrd \
>      > /tmp/data.xml
$ # 5) Run your favorite editor on the XML file
$ # (The data will likely have been transformed.
$ #    Making a backup first wouldn't hurt.)
$ vi /tmp/data.xml
$ # 6) Import the changes
$ rrdtool restore \
>        /tmp/data.xml \
>        /var/lib/munin/example.com/www.example.com-$PLUGIN-d.rrd
$ rm /tmp/data.xml
$ # You might want to delete related graphic files /var/cache/munin/...
$ # 7) Exit munin account and re-enable cron job
$ exit
$ sudo mv /tmp/munin-cron-job /etc/cron.d/munin

take a backup of your rrd, 备份你的rrd,

stop whatever is writing to it, or be quick 停止写任何东西,或快速

export to xml: rrdtool dump thefile.rrd > thefile.xml edit in vi, replacing the offending figure with NaN 导出到xml:rrdtool转储vi中的file.rrd> thefile.xml编辑,用NaN替换有问题的数字

import rrdtool restore thefile.xml (or whatever the syntax is - google it) import rrdtool restore thefile.xml(或者不管语法是什么 - 谷歌吧)

done DONE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM