On Dec 11, 2007 8:11 AM, Florian Forster <<a href="mailto:octo@verplant.org">octo@verplant.org</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Justo :)</blockquote><div>Hi Florian,<br> This is a new version of tomcat plugin<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Thanks for your ``development peak'' at your new plugin :) I didn't have<br>time to read all of your plugin, so the following is based on your email<br>and a quick look at the read function ;)<br><div class="Ih2E3d">
<br>On Mon, Dec 10, 2007 at 01:03:13PM +0100, Justo Alonso wrote:<br>> <plugin tomcat><br>> instance "blog"<br>> url "<a href="http://localhost:8080/collectd/stats" target="_blank">http://localhost:8080/collectd/stats
</a>"<br>> instance "web"<br>> url "<a href="http://localhost:9090/collect/stats" target="_blank">http://localhost:9090/collect/stats</a>"<br>> user "stats"<br>> password "**************"
<br>> </plugin><br><br></div>I'd prefer if the order of the lines didn't make a difference. To get<br>the following syntax you'd need to use the ``complex configuration''<br>scheme. Don't worry about it too much, though - since it's a bit tricky
<br>to parse I'll write a patch against your code, so you don't have to dig<br>into this ;)</blockquote><div><br>don't worry ... I have read de csnmp source plugin and make it on tomcat plugin <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>-- 8< --<br><div class="Ih2E3d"> <Plugin tomcat><br> <Instance "blog"><br> Url "<a href="http://localhost:8080/collectd/stats" target="_blank">http://localhost:8080/collectd/stats</a>
"<br></div> </Instance><br><div class="Ih2E3d"> <Instance "web"><br> Url "<a href="http://localhost:9090/collect/stats" target="_blank">http://localhost:9090/collect/stats</a>"
<br></div> User "stats"<br> Password "**************"<br> </Instance><br> </Plugin><br>-- >8 --<br><div class="Ih2E3d"><br>> On the tomcat side, you need install a collectd servlet.
<br>> [...]<br></div><div class="Ih2E3d">> This servlet is a modification of manager/status, so it's under Apache<br>> license.<br><br></div>What sets this new servlet apart from the already existing servlet? As
<br>far as I've seen you can append `?XML=true' to the servlet bundled with<br>Tomcat and get XML output from that, too..<br><br>> TODO<br><div class="Ih2E3d">> - tomcat_buffer have fix size, maybe a realloc ??
<br><br></div>Do as you think it's practical. If the size of the status page could<br>differ a lot (depending on the setup, I don't think it'll differ between<br>calls much) then realloc would be better. Such a change could be back-
<br>ported to the apache plugin, too..</blockquote><div><br>it's ok .. tomcat_buffer don't have fixed size now ... realloc it on curl_callback<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><div class="Ih2E3d"><br>> - tomcat_instances have fix size, dinamyc list ??<br><br></div>Yes, please.<br><br>Since we talked about this in another thread here's how I'd return an<br>error from the read function in this case:
</blockquote><div> </div><div>I use the llist_* functions on utils_llist file <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>> static int tomcat_read (void)<br>> {<br> int success = 0;<br>> for( x = 0; x <= tomcat_instances_num; x++ ) {<br>> tomcat_instance_t *ti = tomcat_instances[x];<br>><br> /* If this happens there's a bug in the code and it's
<br> * safer not to do anything. */<br>> if( ti == NULL ) {<br>> ERROR ("tomcat: read, instance object is null.");<br>> return (-1);
<br>> }<br>><br> /* ... */<br>><br>> tomcat_buffer_len = 0;<br>> if (curl_easy_perform (ti->curl) != 0)<br>> {<br>> ERROR ("tomcat: curl_easy_perform failed for instance %s: %s",
<br>> ti->name,<br>> tomcat_curl_error);<br> continue;<br>> }<br>><br> /* ... */
<br> success++;<br>> }<br>><br> return ((success > 0) ? 0 : -1)<br>> } /* int tomcat_read */</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br>This means: If ALL instances fail, -1 is returned. If at least one<br>instance succeeded, return 0. Thus the plugin returns -1 if something is<br>seriously broken and it's likely it'll fail again next time it's
<br>called..</blockquote><div><br>ok, implemented now ...<br><br>read it and send me any comments ... <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br>Regards,<br>-octo</blockquote><div><br>thanks,<br>justo <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><font color="#888888">
--<br>Florian octo Forster<br>Hacker in training<br>GnuPG: 0x91523C3D<br><a href="http://verplant.org/" target="_blank">http://verplant.org/</a><br></font><br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.4.6 (GNU/Linux)
<br><br>iD8DBQFHXjgjOIGYkRnzlcMRAn5SAKCXD0eEC9hTON1PJSF2noB1XG0NNgCfQYQO<br>aO4oxn0sBEHUdWJMXlos5OU=<br>=NX4+<br>-----END PGP SIGNATURE-----<br><br></blockquote></div><br>