user2253717
user2253717

Reputation: 25

Get a MAX number in a certain period from a rrd file

I have an rrd file in which cpu average loads are stored.

I would like to know the Maximum Load during a certain period; let's assume within a day.

I wrote:

rrdtool fetch test.rrd MAX -r 300 -e 1364712300 -s -1h

I got so many MAX numbers, so I have to write more code to get the actual maximum number.

My question is: Can I just write a simple command line to get this MAX number?

Upvotes: 1

Views: 6426

Answers (2)

Tobi Oetiker
Tobi Oetiker

Reputation: 5450

If you just want a single number, try

rrdtool graph x -s -1h -e 1364712300 \ 
   DEF:v=test.rrd:ds1:MAX VDEF:vm=v,MAXIMUM PRINT:vm:%lf

this will print a single number on STDOUT. No graph will be created since you did not use any graphing instructions.

Upvotes: 3

Butters
Butters

Reputation: 887

I think this will give you the max for every 5 minute period over your specified time range. Try setting the -r 3600 for a 1 hour max, or -r 86400 for a 24 hour max.

You can verify this by looking at the timestamps given to you with the output.

Upvotes: 0

Related Questions