How to create a graph with Cacti

Two kinds of graph can be generated by Cacti:

  • using a simple data: data are returned by the probe and are directly and completely graphed,
  • or using a data query: data are returned by the probe and must be filtered before to be graphed
The following steps by steps process must be adapted to your metric
Contributors
No contributors found for: authors on selected page(s)

Using a simple data

This is done using a simple script/command based on Petals CLI to collect metric values.

Required input parameters are:

  • the command line to use with its arguments and input fields,
  • output fields

To create such a graph, please follow the following steps:

  1. First, create a new Data Input Method:

    Cacti monitoring extension of Petals CLI is used to get metric values. See the documentation of Petals CLI for more information.
    In the Input String, you will put the command line arguments to connect to the the Petals node for which you want to graph the delivered messages of the local transporter. That's why the command line contains: <petals_host>, <petals_jmx_port>, <petals_jmx_user> and <petals_jmx_password>.
  2. Add an input field for your Petals node hostname

    As the Petals node hostname can be automatically set from the hostname of the monitored host, the field Special Type Code is set.
  3. Add others input fields

    As for the JMX port, create an input field for the Petals JMX username and the Petals JMX user password.
  4. 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:
  5. Check that you have the following Data Input Method:
  6. Create a new Data Template:

    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.
  7. Create the others data items associated to the remaining output fields
  8. A new block Custom data appears, check Use Per-Data Source Value for all except for the Petals node hostname
  9. Create a new Graph Template:
  10. 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')
  11. 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')
  12. Add others Graph Items associated to the remaining data items
  13. Create a New Graph
  14. Set parameters needed to the Data Input Method

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"

Using a data query

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:

<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>
</interface>

Don't forget to adapt the path of Petals CLI to your installation. Petals CLI is used to collect data. See the documentation of Petals CLI for more information.

To create this graph, please follow the following steps:

  1. First, create a new Data Query:
  2. Go to the device for which you want collect metric values, and associate it to the data query previously created
  3. Create a new Data Template:

    Select "Get Script Data (Indexed)" as Data Input Method.
    Add your first data item associated to an output of the data query (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.
  4. Create others data items associated to the remaining output fields (here in the sample, number of delivered messages for message exchange status 'Done' and 'Error')
  5. A new block Custom data appears, check Use Per-Data Source Value for all
  6. Create a new Graph Template:
  7. 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')
  8. 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')
  9. Add others Graph Items associated to the remaining data items
  10. Go to the data query previoulsy created, and associate it to the just create graph template
  11. Associate outputs of the data query to the graph items

    Don't forget to check boxes.
  12. Go to the device for which you want to create the graph, and Create Graphs for this Host

    Select yours endpoints for which you want create a graph

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"

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.