[collectd] Tomcat plugin
Justo Alonso
justo.alonso at gmail.com
Tue Dec 11 10:51:56 CET 2007
On Dec 11, 2007 8:11 AM, Florian Forster <octo at verplant.org> wrote:
> Hi Justo :)
Hi Florian,
>
> Thanks for your ``development peak'' at your new plugin :) I didn't have
> time to read all of your plugin, so the following is based on your email
> and a quick look at the read function ;)
>
cute & paste & minor aspects, isn't a "development peak" XDXDXD ;-)
>
> On Mon, Dec 10, 2007 at 01:03:13PM +0100, Justo Alonso wrote:
> > <plugin tomcat>
> > instance "blog"
> > url "http://localhost:8080/collectd/stats"
> > instance "web"
> > url "http://localhost:9090/collect/stats"
> > user "stats"
> > password "**************"
> > </plugin>
>
> I'd prefer if the order of the lines didn't make a difference. To get
> the following syntax you'd need to use the ``complex configuration''
> scheme. Don't worry about it too much, though - since it's a bit tricky
> to parse I'll write a patch against your code, so you don't have to dig
> into this ;)
> -- 8< --
> <Plugin tomcat>
> <Instance "blog">
> Url "http://localhost:8080/collectd/stats"
> </Instance>
> <Instance "web">
> Url "http://localhost:9090/collect/stats"
> User "stats"
> Password "**************"
> </Instance>
> </Plugin>
> -- >8 --
>
perfect !!
>
> > On the tomcat side, you need install a collectd servlet.
> > [...]
> > This servlet is a modification of manager/status, so it's under Apache
> > license.
>
> What sets this new servlet apart from the already existing servlet? As
> far as I've seen you can append `?XML=true' to the servlet bundled with
> Tomcat and get XML output from that, too..
The manager/status servlet don't have stats for the garbage collector, and
have information about ips, methods, uris of the workers that is not useful
(and increase the length of the result). I cute no-xml output, and a
fullStatus option (I think not useful for us)
> > TODO
> > - tomcat_buffer have fix size, maybe a realloc ??
>
> Do as you think it's practical. If the size of the status page could
> differ a lot (depending on the setup, I don't think it'll differ between
> calls much) then realloc would be better. Such a change could be back-
> ported to the apache plugin, too..
Yes, depends of the configuration, and the workers (maxThreads ) of the
connector. Maybe if we compact stage information, only one '<workers
stage="..KFS..">' tag as apache status, the length of the result can be
under 16k .... umm ...
>
> > - tomcat_instances have fix size, dinamyc list ??
>
> Yes, please.
I'm working on it ...
>
>
> Since we talked about this in another thread here's how I'd return an
> error from the read function in this case:
>
> > static int tomcat_read (void)
> > {
> int success = 0;
> > for( x = 0; x <= tomcat_instances_num; x++ ) {
> > tomcat_instance_t *ti = tomcat_instances[x];
> >
> /* If this happens there's a bug in the code and it's
> * safer not to do anything. */
> > if( ti == NULL ) {
> > ERROR ("tomcat: read, instance object is null.");
> > return (-1);
> > }
> >
> /* ... */
> >
> > tomcat_buffer_len = 0;
> > if (curl_easy_perform (ti->curl) != 0)
> > {
> > ERROR ("tomcat: curl_easy_perform failed for
> instance %s: %s",
> > ti->name,
> > tomcat_curl_error);
> continue;
> > }
> >
> /* ... */
> success++;
> > }
> >
> return ((success > 0) ? 0 : -1)
> > } /* int tomcat_read */
>
> This means: If ALL instances fail, -1 is returned. If at least one
> instance succeeded, return 0. Thus the plugin returns -1 if something is
> seriously broken and it's likely it'll fail again next time it's
> called..
>
ok ... cut & paste it .. ;-)
I hope in this week will send you the modifications.
tia, and sorry for mi english
j
>
> Regards,
> -octo
justo
>
> --
> Florian octo Forster
> Hacker in training
> GnuPG: 0x91523C3D
> http://verplant.org/
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFHXjgjOIGYkRnzlcMRAn5SAKCXD0eEC9hTON1PJSF2noB1XG0NNgCfQYQO
> aO4oxn0sBEHUdWJMXlos5OU=
> =NX4+
> -----END PGP SIGNATURE-----
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.verplant.org/pipermail/collectd/attachments/20071211/d71a10db/attachment.htm
More information about the collectd
mailing list