31.1.9 Creating a New Graph: An Example

This section documents the steps to create a graph. Before creating a graph, review the preceding sections of this chapter as Graphs and Rules use similar components. And for an overview that's specific to graphs, see Section 31.1.2, “Overview of Graph Creation”

This example creates a graph that checks and compares disk usage, by displaying the usage and total available disk space over time.

Begin by navigating to the Configuration, Advisors page, and click the Import/Export link. Then note the Custom Rule/Graph/Data Items Import section. This is where the XML file is imported.

A definition to check disk space usage may look like the following:

<?xml version="1.0"?>
<com_mysql_merlin_server_graph_Design>
    <version>1.0</version> 
    <uuid>a57c2bba-ea9b-102b-b396-94aca32bee29</uuid>
    <name>Custom Graph 001</name>
    <rangeLabel>MB</rangeLabel>
    <series>
        <label>used</label>
        <expression>used_fs/1024/1024</expression>
    </series>
    <series>
        <label>total_size</label>
        <expression>total_fs/1024/1024</expression>
    </series>
    
    <displayprofile>
      <name>Disk Usage - All Filesystems</name>
      <type>Aggregate</type>
      <aggregate op="sum">
        <source>used</source>
        <source>total_size</source>
      </aggregate>
    </displayprofile>
    
    <variables>
        <name>used_fs</name>
        <dcItem>
            <nameSpace>os</nameSpace>
            <className>fs</className>
            <attribName>fs_used</attribName>
        </dcItem>
        <instance>/</instance>
    </variables>
    <variables>
        <name>total_fs</name>
        <dcItem>
            <nameSpace>os</nameSpace>
            <className>fs</className>
            <attribName>fs_total</attribName>
        </dcItem>
        <instance>/</instance>
    </variables>
</com_mysql_merlin_server_graph_Design>

Upon successfully loading a graph, a notification is displayed.

This also creates a new Advisor with the same name as the new graph, which is unscheduled by default. Go to Configuration, Advisors, Graphing to locate and enable this new Advisor.

This graph is displayed on the appropriate graphs page (like every other graph) under the name defined within the definition, which is Custom Graph 001 in the example above.