简体   繁体   中英

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. Is there any way I can easily delete a single data point from the munin data?

I guess I need an rrd editor of some kind, but I'm not sure what will be easiest. Annoying that the data isn't just stored in plaintext :(

Presuming you're running Linux, it goes something like this:

$ # 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,

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

import rrdtool restore thefile.xml (or whatever the syntax is - google it)

done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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