【发布时间】:2010-03-03 21:41:11
【问题描述】:
我正在使用 munin 来监控一个 postgresql 数据库,并且我进行了 1 次更改,导致 munin 获得了一个坏样本(每秒查询数超出正常范围的多个数量级),这搞砸了我的图表。有什么方法可以轻松地从 munin 数据中删除单个数据点?
我想我需要某种类型的 rrd 编辑器,但我不确定哪种最简单。烦人的数据不只是以明文形式存储:(
【问题讨论】:
标签: linux monitoring graph
我正在使用 munin 来监控一个 postgresql 数据库,并且我进行了 1 次更改,导致 munin 获得了一个坏样本(每秒查询数超出正常范围的多个数量级),这搞砸了我的图表。有什么方法可以轻松地从 munin 数据中删除单个数据点?
我想我需要某种类型的 rrd 编辑器,但我不确定哪种最简单。烦人的数据不只是以明文形式存储:(
【问题讨论】:
标签: linux monitoring graph
假设你运行的是 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
【讨论】:
备份你的 rrd,
停止任何正在写入的内容,或者快点
导出到 xml: rrdtool 转储 thefile.rrd > thefile.xml 在 vi 中编辑,用 NaN 替换有问题的数字
进口 rrdtool restore thefile.xml (或任何语法 - 谷歌它)
完成
【讨论】: