On Dec 11, 2007 8:11 AM, Florian Forster &lt;<a href="mailto:octo@verplant.org">octo@verplant.org</a>&gt; 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>&nbsp; &nbsp;&nbsp; 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&#39;&#39; at your new plugin :) I didn&#39;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>&gt; &lt;plugin tomcat&gt;<br>&gt; &nbsp; &nbsp; instance &quot;blog&quot;<br>&gt; &nbsp; &nbsp; url &quot;<a href="http://localhost:8080/collectd/stats" target="_blank">http://localhost:8080/collectd/stats
</a>&quot;<br>&gt; &nbsp; &nbsp; instance &quot;web&quot;<br>&gt; &nbsp; &nbsp; url &quot;<a href="http://localhost:9090/collect/stats" target="_blank">http://localhost:9090/collect/stats</a>&quot;<br>&gt; &nbsp; &nbsp; user &quot;stats&quot;<br>&gt; &nbsp; &nbsp; password &quot;**************&quot;
<br>&gt; &lt;/plugin&gt;<br><br></div>I&#39;d prefer if the order of the lines didn&#39;t make a difference. To get<br>the following syntax you&#39;d need to use the ``complex configuration&#39;&#39;<br>scheme. Don&#39;t worry about it too much, though - since it&#39;s a bit tricky
<br>to parse I&#39;ll write a patch against your code, so you don&#39;t have to dig<br>into this ;)</blockquote><div><br>don&#39;t worry ... I have read de csnmp&nbsp; source plugin and&nbsp; 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&lt; --<br><div class="Ih2E3d">&nbsp;&lt;Plugin tomcat&gt;<br> &nbsp; &lt;Instance &quot;blog&quot;&gt;<br> &nbsp; &nbsp; Url &quot;<a href="http://localhost:8080/collectd/stats" target="_blank">http://localhost:8080/collectd/stats</a>
&quot;<br></div> &nbsp; &lt;/Instance&gt;<br><div class="Ih2E3d"> &nbsp; &lt;Instance &quot;web&quot;&gt;<br> &nbsp; &nbsp; Url &quot;<a href="http://localhost:9090/collect/stats" target="_blank">http://localhost:9090/collect/stats</a>&quot;
<br></div> &nbsp; &nbsp; User &quot;stats&quot;<br> &nbsp; &nbsp; Password &quot;**************&quot;<br> &nbsp; &lt;/Instance&gt;<br>&nbsp;&lt;/Plugin&gt;<br>-- &gt;8 --<br><div class="Ih2E3d"><br>&gt; On the tomcat side, you need install a collectd servlet.
<br>&gt; [...]<br></div><div class="Ih2E3d">&gt; This servlet is a modification of manager/status, so it&#39;s under Apache<br>&gt; license.<br><br></div>What sets this new servlet apart from the already existing servlet? As
<br>far as I&#39;ve seen you can append `?XML=true&#39; to the servlet bundled with<br>Tomcat and get XML output from that, too..<br><br>&gt; TODO<br><div class="Ih2E3d">&gt; &nbsp; &nbsp;- tomcat_buffer have fix size, maybe a realloc ??
<br><br></div>Do as you think it&#39;s practical. If the size of the status page could<br>differ a lot (depending on the setup, I don&#39;t think it&#39;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&#39;s ok .. tomcat_buffer don&#39;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>&gt; &nbsp; &nbsp;- tomcat_instances have fix size, dinamyc list ??<br><br></div>Yes, please.<br><br>Since we talked about this in another thread here&#39;s how I&#39;d return an<br>error from the read function in this case:
</blockquote><div>&nbsp;</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>&gt; static int tomcat_read (void)<br>&gt; {<br> &nbsp; &nbsp; &nbsp; &nbsp;int success = 0;<br>&gt; &nbsp; &nbsp; &nbsp; for( x = 0; x &lt;= tomcat_instances_num; x++ ) {<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tomcat_instance_t *ti = tomcat_instances[x];<br>&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* If this happens there&#39;s a bug in the code and it&#39;s
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * safer not to do anything. */<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( ti == NULL ) {<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ERROR (&quot;tomcat: read, instance object is null.&quot;);<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (-1);
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* ... */<br>&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tomcat_buffer_len = 0;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (curl_easy_perform (ti-&gt;curl) != 0)<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ERROR (&quot;tomcat: curl_easy_perform failed for instance %s: %s&quot;,
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ti-&gt;name,<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tomcat_curl_error);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;continue;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* ... */
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;success++;<br>&gt; &nbsp; &nbsp; &nbsp; }<br>&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;return ((success &gt; 0) ? 0 : -1)<br>&gt; } /* 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&#39;s likely it&#39;ll fail again next time it&#39;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>