Start graph at 1st of current month?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Start graph at 1st of current month?

defkev
Hi,

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

e.g.
if i want my graph to start today at midnight i simple use something like:
>start=midnight

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.

Any advice greatly appreciated!

Thanks
Cheers
Reply | Threaded
Open this post in threaded view
|

Re: Start graph at 1st of current month?

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

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.

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: Start graph at 1st of current month?

Petteri Matilainen
In reply to this post by defkev
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.

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

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: Start graph at 1st of current month?

spock
In reply to this post by defkev
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=[hidden email]] Im Auftrag von defkev
Gesendet: Montag, 3. November 2014 01:53
An: [hidden email]
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.
if i want my graph to start today at midnight i simple use something like:
>start=midnight

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.

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.

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users