summaryrefslogtreecommitdiff
path: root/qpid/doc/book/src/InfoPlugin.xml
blob: aebcd08c0262c4177120a7fecfa77566a7aec130 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<?xml version="1.0" encoding="utf-8"?>
<!--
 
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at
 
   http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 
-->

<section xmlns="http://docbook.org/ns/docbook" version="5.0">
<title>
OSGI Info Plugin
</title>
 <para> The Info OSGI Plugin was developed as a mean of monitoring the qpid broker startup/shutdown
      times along with selected JVM and OS details. It was written as a OSGI plugin so it can be
      used as needed. </para>


<section>
 <title>How it works</title>
 <para> Assuming the plugin is deployed, upon the Activator invocation (which happens when OSGI
         loads the bundles), the plugin looks for its configuration file. If the file cannot be
         found, the plugin does not perform any operation and will silently exit. If the
         configuration is found, it is loaded and parsed. A predefined set of data is collected and
         messages are generated as per the configuration templates (see below for details).</para>
      <para> Further, the messages are sent using one of the supported protocols (currently http
         post and soap) to the configured destination. The same scenario takes place on the plugin
         unload phase which usually takes place upon broker shutdown. </para>
</section>

<section>
 <title>Data Gathering</title>
 <para>
The info plugin collects a pre-defined set of data, and generates a  message according to a template
defined in each section of the ini file. Data can be  of 2 categories: 
<orderedlist numeration="loweralpha" spacing="normal">
 <listitem>
   <para>JVM specific</para>
 </listitem>
 <listitem>
   <para>application specific</para> 
 </listitem>
 </orderedlist>
 </para>
 <para>
Each data has a variable name associated which can be used for the message generation template.
The convention chosen for template is: @[variable (in uppercase)] (eg @IP, @PORT) (see configuration section
for message examples). 
</para>
<para>
The following application specific info are gathered (variable names in round brackets):

 <orderedlist numeration="arabic" spacing="normal">
   <listitem>
     <para>The JMX Port the application is listening to  (jmxport)</para>
   </listitem>   
   <listitem>
     <para>The Port(s) the broker is listening to, comma delimited (port)</para>
   </listitem>
   <listitem>  
       <para>The Broker Version (version)</para>
   </listitem>
   <listitem>
       <para>The key store path  (KeystorePath)</para>
   </listitem>
   <listitem>
       <para>The Plugin Directory (PluginDirectory)</para>
   </listitem>
   <listitem>
       <para>The QPID work directory (QpidWork)</para>
   </listitem>
   <listitem>
       <para>The JMX Principal Database (JMXPrincipalDatabase)</para>
    </listitem>
</orderedlist>
</para>
 <para>
The following JVM specific info are collected (variable names in round brackets):

  <orderedlist numeration="arabic" spacing="normal">
  <listitem>
      <para>Hostname (hostname)</para>
  </listitem>
   <listitem>
      <para>IP address of the current machine (ip)</para>
   </listitem>
   <listitem>
      <para>Number of CPU cores (CPUCores)</para>
   </listitem>
   <listitem>
      <para>Maximum memory (Maximum_Memory)</para>
   </listitem>
   <listitem>
      <para>Free Memory (Free_Memory)</para>
   </listitem>
   <listitem>
      <para>Java Class Path (java.class.path)</para>
   </listitem>
   <listitem>
      <para>Jave Home (java.home)</para>
   </listitem>
   <listitem>
      <para>Java VM Name (java.vm.name)</para>
   </listitem>
   <listitem>
      <para>Java VM Vendor (java.vm.vendor)</para>
   </listitem>
   <listitem>
      <para>Java VM Version (java.vm.version)</para>
   </listitem>
   <listitem>
      <para>Java Class Version (java.class.version)</para>
   </listitem>
   <listitem>
      <para>Java Runtime Version (java.runtime.version)</para>
   </listitem>
   <listitem>
      <para>OS Architecture (os.arch)</para>
   </listitem>
   <listitem>
      <para>Sun Architecture Data Model (sun.arch.data.model)</para>
   </listitem>
   <listitem>
      <para>User home directory (user.home)</para>
   </listitem>
   <listitem>
      <para>User Name (user.name)</para>
   </listitem>
   <listitem>
      <para>User Time Zone (user.timezone)</para>
   </listitem>
 </orderedlist>
</para>
</section>


<section>
 <title>Plugin Configuration</title>
<para>
The plugin configuration file is currently hardcoded to be: $QPID_HOME/etc/qpidinfo.ini
We plan to provide a mean to change the configuration by using system property (eg -DInfoPluginConfig) but
currently this is not available.
</para>
<para>
As it might be useful to send more than 1 message, eventually to different destinations, 
we chose an ini file layout for the plugin configuration that consists of  a global section 
and set of individual sections, one for each message to be sent. 
</para>
 <para>
  The configuration file has a global section composed of any key-value pairs placed before the start 
  of an ini-type section (eg [section]). The role of the global section is to provide a set of values 
  that would be inferred in each subsequent section. Any section from the config file can override any 
  global variable by specifying the respective key-value pair inside. 
 </para>
 <para> The key protocol is mandatory, the plugin will not work if protocol=soap or protocol=http is
         not specified. For soap, we expect the following keys to be present: <itemizedlist>
            <listitem>
               <para>soap.hostname</para>
            </listitem>
            <listitem>
               <para>soap.port</para>
            </listitem>
            <listitem>
               <para>soap.path</para>
            </listitem>
            <listitem>
               <para>soap.envelope</para>
            </listitem>
         </itemizedlist> For http the following keys have to be present: <itemizedlist>
            <listitem>
               <para>http.url</para>
            </listitem>
            <listitem>
               <para>http.envelope</para>
            </listitem>
         </itemizedlist> The names are self-explanatory, please see the example below. The protocol
         key cannot be overwritten in the sections and it has to be chosen initially. </para>
 </section>

<section><title>Example Configuration</title>
 <para>
For soap messages, we will abbreviate the XML header by omitting the namespaces in the config, 
in order to be more readable. A minimal  correct XML for the soap envelope would be
  <programlisting>
   <![CDATA[
   <?xml version=\"1.0\"?>
   <soap:Envelope 
      xmlns:soap=\"http://www.w3.org/2001/12/soap-envelope\" 
      soap:encodingStyle=\"http://www.w3.org/2001/12/soap-encoding\"> 
      ...some content...
   </soap:Envelope>
   ]]>
  </programlisting>
 
 NB. On the ini file, there can be no text wrapping for any entry (as above), the whole text should come into 
 a single line, irrespective of how long it is. 
 
 </para>
 
<programlisting>
<![CDATA[
## Ini file using SOAP
protocol=soap
soap.hostname=host1
soap.port=8080

[Message1]
soap.path=/axis2/services/QpidInfo
soap.action=qpidevent
soap.envelope=<?xml version=\"1.0\"?><soap:Envelope>@ACTION-@VERSION</soap:Envelope>

[Message2]
soap.hostname=host2
soap.port=9090
soap.path=/axis1/services/Info
soap.envelope=<?xml version=\"1.0\"?><soap:Envelope">@ACTION-@VERSION from @IP:@PORT</soap:Envelope>

##  End of File
]]>
</programlisting>
  
<para>
and another example, this time using http:

<programlisting>
<![CDATA[
protocol=http
http.url=http://mywebserver:8080/postServlet

[Message1]
http.envelope=Event from qpid broker at: @IP, running qpid version: @VERSION

[Message2]
http.url=http://myotherwebserver:9090/postServlet1
http.envelope=Event for qpid broker @VERSION from @IP:@PORT running java @JAVA.VM.VERSION 
]]>
</programlisting>
  </para>
  <para>
   The ini file is supporting comments starting with # or ; anywhere in the file. 
   The global section is considered to be the first set of lines from the ini file before the first [Section] encountered. 
  </para>
 </section>
 
</section>