Writing my first add-on for Cacti (NEWBIE ALERT!)

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

Post Reply
Toontje2
Posts: 5
Joined: Sat Jan 12, 2013 1:27 pm

Writing my first add-on for Cacti (NEWBIE ALERT!)

Post by Toontje2 »

I am running a HAM Radio DX Cluster and this piece of software has standard an MRTG graphing function for visualizing statistics. I want to move that to Cacti.

Basically what the software does is write textfiles with data i want to graph. For example, i can graph the total number of users connected. What MRTG does is a cat of a file that looks like this:

Code: Select all

6
7
0 15:47
where 6 is the average number of users, 7 the max and 0 the current number of users. 15:47 is the time the stats were generated.
I created a Data Input Method that looks like this:
Image
Then i created a Data Query that looks like this:
Image
with an XML file that looks like this:

Code: Select all

<urls>
        <name>Get Total Users</name>
        <script_path>cat /spider/mrtg/totalusers</script_path>
        <arg_prepend>|host_id|</arg_prepend>
        <arg_num_indexes>count</arg_num_indexes>
        <arg_index>index</arg_index>
        <arg_query>query</arg_query>
        <arg_get>get</arg_get>
        <output_delimeter></output_delimeter>
        <fields>
                <avg>
                        <name>avg</name>
                        <direction>output</direction>
                        <query_name>avg</query_name>
                </values>
                <max>
                        <name>max</name>
                        <direction>output</direction>
                        <query_name>max</query_name>
                </max>
                <cur>
                        <name>cur</name>
                        <direction>output</direction>
                        <query_name>cur</query_name>
                </cur>
        </fields>
</urls>
I am now at the stage where, when i add the Data Query to my device, my data query debug information tells me:

Code: Select all

+ Running data query [11].
+ Found type = '4' [Script Query].
+ Found data query XML file at '/usr/share/cacti/site/plugins/dxspider/xml/dxspider.xml'
+ Error parsing XML file into an array.
+ Found data query XML file at '/usr/share/cacti/site/plugins/dxspider/xml/dxspider.xml'
+ Found data query XML file at '/usr/share/cacti/site/plugins/dxspider/xml/dxspider.xml'
+ Found data query XML file at '/usr/share/cacti/site/plugins/dxspider/xml/dxspider.xml'
which is probably caused by the fact that i don't define a output delimiter in the XML. What is the output delimiter for a line-break?

This is done without reading (or finding, for that matter) a step-by-step guide on how to develop for Cacti and this is my first attempt to write something for Cacti, so i'm probably doing a zillion things wrong.

Any help or links to help is appreciated.

Thanks,

Ton.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest