8 +---------------------------------------------------------------------------+
9 | This script import cacti xml template files by command line |
10 | Author : Jean Francois Masure <jean-francois.masure@arche.fr> |
11 | Version : 0.1 8 Aug 2005 |
12 | Modified by PLD Linux Team <http://www.pld-linux.org> |
13 +---------------------------------------------------------------------------+
17 require_once '/usr/share/cacti/include/global.php';
18 require_once '/usr/share/cacti/lib/import.php';
20 // check if we have good number of argument
21 if ($argc < 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
22 echo "Usage: $argv[0] FILE.xml [FILE.xml]\n";
23 echo "This script will import FILE.xml template into cacti\n";
28 foreach ($argv as $xml_file) {
29 $xml_data = file_get_contents($xml_file);
30 if ($xml_data === false) {
31 fprintf(STDERR, "ERROR: cannot open $xml_file, exiting\n");
35 // import data into cacti. $info_array will contain debugging info.
36 echo "cacti-add_template: importing $xml_file\n";
37 $info_array = import_xml_data($xml_data, false);