[rrd-users] Start graph at 1st of current month?

Petteri Matilainen pmatil at gmail.com
Mon Nov 3 10:11:39 CET 2014

On 3.11.2014 2:52, defkev wrote:
> Hi,
> i am looking for the monthly equivalent - if there is any - to the daily
> "midnight" AT-TIME
> but what if i want my graph to start at the 1st of the current month?
> all i could come up with was something like this:
>> start=midnight 01.11
> which will indeed start the graph at the 1st of November, but not very handy
> as i have to modify the RPN for every concurrent month.


I use the following way to draw a vertical line (VRULE) to midnight at 
my monthly graph.

month=`date +%-d` # Current day of month

if [ $month -eq 1 ]
daat=`date -d "" +%s` # If day of month number is 1 then current day is 
month=$(($month -1))
daat=`date -d "$month days ago 00:00:00" +%s` # Else get the first day 
of month's time at 00:00:00

I have tested it today and it outputs Sat November 01 00:00 in epoch 
format for rrdtool in the variable daat. I'm sure there is a nicer way 
to compute this but it seems to work...


More information about the rrd-users mailing list