[smokeping-users] RRD Command for generating Smokeping graphs via CLI

Tobias Oetiker tobi at oetiker.ch
Fri Jul 13 09:34:23 CEST 2012


Hi Joe,

this patch might help:

diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm
index 2d6e1e5..f9d162c 100644
--- a/lib/Smokeping.pm
+++ b/lib/Smokeping.pm
@@ -1156,7 +1156,8 @@ sub get_detail ($$$$;$){

        $q->param('epoch_start',parse_datetime($q->param('start')));
        $q->param('epoch_end',parse_datetime($q->param('end')));
-        @tasks = (["Navigator Graph".$name, parse_datetime($q->param('start')),parse_datetime($q->param('end'))]);
+    my $title = $q->param('title') || ("Navigator Graph".$name);
+    @tasks = ([$title, parse_datetime($q->param('start')),parse_datetime($q->param('end'))]);
         my ($graphret,$xs,$ys) = RRDs::graph
           ("dummy",
            '--start', $tasks[0][1],


now you can specify the title as a cgi parameter

cheers
tobi

Today Borg, Joe, Vodafone Malta wrote:

> Hi Don,
> Many thanks for your response and no worries re: being blunt.
>
> Essentially, you are right - only that the only custom item I require is the title. In other words, the legend and everything else on the graph should remain the same as what's seen in smokeping. Moreover though, I also need to 'automate' this graph generation via CLI/ a perl script.
>
> So to do the above, I thought the best way would be to use the rrdtool directly from CLI; something like:
>
> /usr/bin/rrdtool graph - --imgformat=PNG --start=-31536000 --end=-300 --title="customer abc instead of Navigator Graph"................
>
> What I was after was simply the list of all the parameters I might need to pass to rrdtool so as to generate a graph that looks exactly like the ones generated by smokeping (only with a different title).
>
> I'll go through the links you provided me with as the second one seems promising.
>
>
> The alternative to all the above would be to run something like this from a linux CLI:
>
> [root at foo /]# wget " http://oss.oetiker.ch/smokeping-demo/?displaymode=a;start=2007-08-15%2015:31;end=now;target=Customers.ITIS.otoro"
>
> The above is also fine for me and would be much simpler. The only problem with it is that I don't know if/how I could modify the graph title of the png file generated? Maybe there's some other url parameter I can pass? E.g. ?displaymode=a;start=2007-08-15%2015:31;end=now;target=Customers.ITIS.otoro;title=customer.abc (<-note added parameter).
>
>
> Thanks for all your help.
>
> Joe
>
>
> -----Original Message-----
> From: Don Gould [mailto:don at bowenvale.co.nz]
> Sent: 13 July 2012 03:36
> To: Borg, Joe, Vodafone Malta
> Cc: Ryan Becker; smokeping-users at lists.oetiker.ch
> Subject: Re: [smokeping-users] RRD Command for generating Smokeping graphs via CLI
>
> Joe,
>
> My reading of this thread is that you have asked the wrong question.
> Or, at least you have not explained what you requirement is very clearly
> and I wonder if you have also asked on the wrong list.[1]
>
> As a result you are not getting the help you're looking for.
>
> My understanding of your requirement:
>
> * Produce a graph 'image' from an RRDTool database with custom titles
> and legend information on it.
>
> ------------
>
> The fact that the "SmokePing" application put the data in to the RRDTool
> database is only coincidental.
>
> So, http://oss.oetiker.ch/rrdtool/
>
> http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html
>
> http://oss.oetiker.ch/rrdtool/doc/rrdgraph_examples.en.html
>
> Is this more what you're after?
>
> D
>
> [1] Please excuse my blunt, and perhaps rude, break down of the problem
> here.  I do not mean to offend, I just felts you weren't getting
> anywhere and wondered if it's a language problem that's causing
> confusion.  So the best way I could think of to try and help was by
> being a bit more direct and black and white.
>
>
> On 12/07/2012 6:42 p.m., Borg, Joe, Vodafone Malta wrote:
> > Thanks Ryan/Tobias,
> >
> > Yes I got there. In fact, in the second thread I listed in my email,
> > there's mention of the use of displaymod=a which displays the graph
> > alone (e.g.
> > http://oss.oetiker.ch/smokeping-demo/?displaymode=a;start=2007-08-15%2015:31;end=now;target=Customers.ITIS.otoro).
> > This is **nearly** what I want. I could use this via CLI with something
> > like wget in a script. The problem is, as far as I can see, there are
> > some things I can't modify. In particular, I'd like to modify the graph
> > title (currently 'Navigator Graph') to be something else (e.g. 'Customer
> > ABC's Link'). Is this possible with some URL paramet?
> >
> > Note that I'm referring to the title of the png graph itself, not the
> > HTML titles as part of the smokeping interface...
> >
> > Thanks,
> >
> > Joe
> >
> > *From:*Ryan Becker [mailto:rb14060 at gmail.com]
> > *Sent:* 11 July 2012 17:49
> > *To:* Borg, Joe, Vodafone Malta
> > *Cc:* Tobias Oetiker; smokeping-users at lists.oetiker.ch
> > *Subject:* Re: [smokeping-users] RRD Command for generating Smokeping
> > graphs via CLI
> >
> > He's referring to the Navigator Graph option. Go into the CGI, click on
> > a monitored node, then click on the graph itself. It should take you to
> > a new window and the title of the graph should be "Navigator Graph".
> > There's parameters that you can set in the URL, and you can see them
> > clearly.
> >
> > On Wed, Jul 11, 2012 at 8:53 AM, Borg, Joe, Vodafone Malta
> > <Joe.Borg at vodafone.com <mailto:Joe.Borg at vodafone.com>> wrote:
> >
> > Hi Tobias,
> > Many thanks for getting back to me on this and for the prompt reply.
> > Would you be able to let me know where/how I can find the graph
> > navigator as I'm unsure as to what you're referring to?
> >
> > Thanks,
> >
> > Joe
> >
> > -----Original Message-----
> > From: Tobias Oetiker [mailto:tobi at oetiker.ch <mailto:tobi at oetiker.ch>]
> > Sent: 10 July 2012 21:43
> > To: Borg, Joe, Vodafone Malta
> > Cc: smokeping-users at lists.oetiker.ch
> > <mailto:smokeping-users at lists.oetiker.ch>
> > Subject: Re: [smokeping-users] RRD Command for generating Smokeping
> > graphs via CLI
> >
> > have a look at the graph navigator. you can get charts directly from the cgi
> > cheers
> > Tobias Oetiker
> >
> > On 10.07.2012, at 11:38, "Borg, Joe, Vodafone Malta"
> > <Joe.Borg at vodafone.com <mailto:Joe.Borg at vodafone.com>> wrote:
> >
> >  > Hi,
> >  > I need to write a script that generates the smokeping graphs for use
> > in another front-end (i.e. without accessing the smokeping cgi
> > directly). Would anyone have the relevant rrd command and parameters I
> > should use or an easy way to find out what it is?
> >  >
> >  > I've read the following threads:
> >  >
> >  >
> > https://lists.oetiker.ch/pipermail/smokeping-users/2011-November/004519.html
> > - This is what I need; unfortunately there doesn't seem to be a
> > conclusion to this thread.
> >  >
> >  >
> > https://lists.oetiker.ch/pipermail/smokeping-users/2007-August/002420.html
> > - This mentions the use of 'displaymod=a' which I've tried and is close
> > to what I want (I could use something like wget to get the graph).
> > Unfortunately though it doesn't allow for any modification of the graph
> > itself and I need to modify some minor things such as the graph title.
> >  >
> >  > Any help would be appreciated.
> >  >
> >  >
> >  > Thanks & Regards,
> >  >
> >  >
> >  > Joe
> >  >
> > -------------------------------------------------------------------------------------
> >  > Vodafone
> >  >
> > -------------------------------------------------------------------------------------
> >  >
> >  > This email is intended only for the use of individuals to whom it is
> > addressed, as it may contain confidential or privileged information. If
> > you are not a named addressee, intended recipient, or the person
> > responsible for delivering the message to the named addressee, be
> > advised that you have received this email in error and that you should
> > not disseminate, distribute, print, copy this mail or otherwise divulge
> > its contents. In such instances, please notify Vodafone Malta Limited on
> > telephone number +356 99999247 <tel:%2B356%2099999247> and delete this
> > email from your system. Since this transmission was affected via email,
> > Vodafone Malta Limited cannot guarantee that it is secure or error-free
> > as information could be intercepted, corrupted, lost, destroyed, arrive
> > late or incomplete, or contain viruses. Vodafone Malta Limited does not
> > accept liability for any errors or omissions in the contents of this
> > message which arise as a result of email transmission.
> >  >
> >  > Save the environment for our children - Print e-mail only when necessary.
> >  >
> >  >
> >  > _______________________________________________
> >  > smokeping-users mailing list
> >  > smokeping-users at lists.oetiker.ch
> > <mailto:smokeping-users at lists.oetiker.ch>
> >  > https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users
> >  >
> > -------------------------------------------------------------------------------------
> > Vodafone
> > -------------------------------------------------------------------------------------
> >
> > This email is intended only for the use of individuals to whom it is
> > addressed, as it may contain confidential or privileged information. If
> > you are not a named addressee, intended recipient, or the person
> > responsible for delivering the message to the named addressee, be
> > advised that you have received this email in error and that you should
> > not disseminate, distribute, print, copy this mail or otherwise divulge
> > its contents. In such instances, please notify Vodafone Malta Limited on
> > telephone number +356 99999247 <tel:%2B356%2099999247> and delete this
> > email from your system. Since this transmission was affected via email,
> > Vodafone Malta Limited cannot guarantee that it is secure or error-free
> > as information could be intercepted, corrupted, lost, destroyed, arrive
> > late or incomplete, or contain viruses. Vodafone Malta Limited does not
> > accept liability for any errors or omissions in the contents of this
> > message which arise as a result of email transmission.
> >
> > Save the environment for our children - Print e-mail only when necessary.
> >
> >
> > _______________________________________________
> > smokeping-users mailing list
> > smokeping-users at lists.oetiker.ch <mailto:smokeping-users at lists.oetiker.ch>
> > https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users
> >
> >
> >
> > -------------------------------------------------------------------------------------
> > Vodafone
> > -------------------------------------------------------------------------------------
> >
> > This email is intended only for the use of individuals to whom it is
> > addressed, as it may contain confidential or privileged information. If
> > you are not a named addressee, intended recipient, or the person
> > responsible for delivering the message to the named addressee, be
> > advised that you have received this email in error and that you should
> > not disseminate, distribute, print, copy this mail or otherwise divulge
> > its contents. In such instances, please notify Vodafone Malta Limited on
> > telephone number +356 99999247 and delete this email from your system.
> > Since this transmission was affected via email, Vodafone Malta Limited
> > cannot guarantee that it is secure or error-free as information could be
> > intercepted, corrupted, lost, destroyed, arrive late or incomplete, or
> > contain viruses. Vodafone Malta Limited does not accept liability for
> > any errors or omissions in the contents of this message which arise as a
> > result of email transmission.
> >
> > Save the environment for our children - Print e-mail only when necessary.
> >
> >
> >
> >
> > _______________________________________________
> > smokeping-users mailing list
> > smokeping-users at lists.oetiker.ch
> > https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the smokeping-users mailing list