
!petals-container-localtransporter-dim-petals-host.jpg|align=center!
As the Petals node hostname can be automatically set from the hostname of the monitored host, the field *Special Type Code* is set.
# Add others *input fields*
!petals-container-localtransporter-dim-petals-jmx-port.jpg|align=center!
As for the JMX port, create an input field for the Petals JMX username and the Petals JMX user password.
# Add the *output fields* returned by the script
For each output fields of the script/command (here, in the sample, for each message exchange status "Active", "Done" and "Error"), create an output field:
!petals-container-localtransporter-dim-output-active.jpg|align=center!
# Check that you have the following *Data Input Method*:
!petals-container-localtransporter-dim-full.jpg|align=center!
# Create a new *Data Template*:
!petals-container-localtransporter-dt.jpg|align=center!
Select your data input method previously created as *Data Input Method*.
Add your first *data item* associated to an output field of the script/command previously created (here in the sample, the number of delivered messages for message exchange status 'Active'). The *data source type* of the item must be correctly set according to the output field type.
# Create the others *data items* associated to the remaining output fields
!petals-container-localtransporter-dt-items.jpg|align=center!
# A new block *Custom data* appears, check *Use Per-Data Source Value* for all except for the Petals node hostname
!petals-container-localtransporter-dt-custom.jpg|align=center!
# Create a new *Graph Template*:
!petals-container-localtransporter-gt.jpg|align=center!
# Add a *Graph Item* to graphed one of the previous *data item* (here in the sample, the number of delivered messages for message exchange status 'Active')
!petals-container-localtransporter-gt-active.jpg|align=center!
# Add a *Graph Item* to displayed the legend of your *data item* (here in the sample, the number of delivered messages for message exchange status 'Active')
!petals-container-localtransporter-gt-active-legend.jpg|align=center!
# Add others *Graph Items* associated to the remaining *data items*
!petals-container-localtransporter-gt-full.jpg|align=center!
# Create a *New Graph*
!petals-container-localtransporter-ng.jpg|align=center!
# Set parameters needed to the *Data Input Method*
!petals-container-localtransporter-ng-params.jpg|align=center!
The new graph can be viewed after several minutes needed to collect data. By default a collect is done every 5 minutes. To view the graph, go into *Graph management"
{anchor:Creating a graph using a data query}
h1. Using a data query
!petals-delivered-messages-by-endpoint.png|align=center!
This is done using a *data query* to collect metric values.
Required input parameters are:
* the data query,
* the output fields.
The data query definition of our sample to put in the XML file is:
{code}
<interface>
<name>Get Delivered Messages by the Local transporter to an endpoint</name>
<script_path>/home/cdeneux/petals-cli-2.1.1-SNAPSHOT/bin/petals-cli.sh</script_path>
<arg_prepend>-h localhost -n 7700 -u petals -p petals -c -- monitoring -o local-transporter -f delivered-messages</arg_prepend>
<arg_index>-- --list-endpoints</arg_index>
<arg_query>-- --query-endpoints</arg_query>
<arg_get>-- --query-endpoints</arg_get>
<output_delimeter>!</output_delimeter>
<index_order>endpointName</index_order>
<index_order_type>alphanumeric</index_order_type>
<!--index_title_format>|chosen_order_field|</index_title_format-->
<fields>
<endpointName>
<name>Endpoint name</name>
<direction>input</direction>
<query_name>NAME</query_name>
</endpointName>
<activeDeliveredMsgs>
<name>Active Message exchange delivered counter</name>
<direction>output</direction>
<query_name>ACTIVE</query_name>
</activeDeliveredMsgs>
<doneDeliveredMsgs>
<name>Done Message exchange delivered counter</name>
<direction>output</direction>
<query_name>DONE</query_name>
</doneDeliveredMsgs>
<errorDeliveredMsgs>
<name>Error Message exchange delivered counter</name>
<direction>output</direction>
<query_name>ERROR</query_name>
</errorDeliveredMsgs>
</fields>