Beginners Script Server guide for new scripts?

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
WooLaf
Posts: 7
Joined: Thu Jul 24, 2014 3:55 pm

Beginners Script Server guide for new scripts?

Post by WooLaf »

Is there a guide for new users of Cacti to the Script Server? I can find in the manual only information about migrating existing scripts to it - but no step by step to develop a new script.

I have made a very basic script called ss_cactitest.php which is just returning a random value, the output correct shows when using the script_server from the CLI

Code: Select all

/* standard code removed for clarity */ 
function ss_cactitest() {
    return 'testval:'.rand(1,1000);
}

Code: Select all

root@debian:/usr/share/cacti/site# php script_server.php
PHP Script Server has Started - Parent is cmd
scripts/ss_cactitest.php ss_cactitest
testval:317
I've setup a Data query, Data template, Data Source and Associated the data query with localhost. I've obviously missed something because I've enabled Statistics logging but there's nothing showing up on the log for my test script.

I'm happy to keep reading about this and work it out - but I'm just not even sure where to start looking
WooLaf
Posts: 7
Joined: Thu Jul 24, 2014 3:55 pm

Re: Beginners Script Server guide for new scripts?

Post by WooLaf »

Well I made a little progress, but not seeing results.

I'm also a little confused about the Data Query xml needed, the documentation says the opening tag should be <query> however both of the example xmls (host_cpu.xml, host_disk.xml) use <interface>. Is <query> correct for PHP Server Scripts?

The documentation also says that you may need to restart the script server, but gives no instructions how that should be done.

For information, the Data Query debug information from the Device tab shows this

Code: Select all

Data Query Debug Information
+ Running data query [11].
+ Found type = '6' [Script Query - Script Server].
+ Found data query XML file at '/usr/share/cacti/site/resource/script_server/ss_cactitest.xml'
+ XML file parsed ok.
+ <arg_num_indexes> missing in XML file, 'Index Count Changed' not supported
+ Executing script for list of indexes '"/usr/bin/php" -q /usr/share/cacti/site/scripts/ss_cactitest.php ' Index Count: 1
+ Found index: testval:814
WooLaf
Posts: 7
Joined: Thu Jul 24, 2014 3:55 pm

Re: Beginners Script Server guide for new scripts?

Post by WooLaf »

Actually I have just found http://docs.cacti.net/manual:088:3a_adv ... alkthrough which, although it's in the 8.8 manual pages looks to be a direct copy+paste from the same section of 8.7. I understand there were minor changes with the xml format but I will try to follow this guide. Certainly the php script in the example is doing more than mine is.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests