Discussion:
[rrd-users] Start graph at 1st of current month?
(too old to reply)
defkev
2014-11-03 00:52:52 UTC
Permalink
Hi,

i am looking for the monthly equivalent - if there is any - to the daily
"midnight" AT-TIME

e.g.
start=midnight
but what if i want my graph to start at the 1st of the current month?
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.

Any advice greatly appreciated!

Thanks
Cheers



--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/Start-graph-at-1st-of-current-month-tp7582582.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
Simon Hobson
2014-11-03 07:59:57 UTC
Permalink
Post by defkev
but what if i want my graph to start at the 1st of the current month?
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.
Use "start=${StartTime}" and set StartTime in the script you use to call RRD.

RRD does not have any concept of "week", "month", "year" - and only limited concept of "day" given that "midnight" is only "midnight in UTC timezone". That means you need to do some work external to RRD if you need to work with calendar periods.
Petteri Matilainen
2014-11-03 09:11:39 UTC
Permalink
Post by defkev
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?
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.
Hi,

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 ]
then
daat=`date -d "" +%s` # If day of month number is 1 then current day is
today
else
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
fi

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...

regards
SAPPERS Collector
2014-11-03 09:27:09 UTC
Permalink
I am using in my shell skript:

graph_start_month=$(date --date "$(date "+%Y%m01") 00:00" +%s)

This will give you the unix time (an integer) of the first of the current month.
It will use the timezone of your linux / unix environment.

Example for rrdtool call:

eval "rrdtool graph tempday.png \
-t \"am $(date -d @$j '+%A, den %d.%m.%Y')\" \
-e $(($graph_start_month + 86399)) -s $graph_start_month $graph_defs $graph_caption_past"

Regards,
Spock


-----Ursprüngliche Nachricht-----
Von: rrd-users [mailto:rrd-users-bounces+collector=***@lists.oetiker.ch] Im Auftrag von defkev
Gesendet: Montag, 3. November 2014 01:53
An: rrd-***@lists.oetiker.ch
Betreff: [rrd-users] Start graph at 1st of current month?

Hi,

i am looking for the monthly equivalent - if there is any - to the daily "midnight" AT-TIME

e.g.
start=midnight
but what if i want my graph to start at the 1st of the current month?
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.

Any advice greatly appreciated!

Thanks
Cheers



--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/Start-graph-at-1st-of-current-month-tp7582582.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
Loading...