4 +---------------------------------------------------------------------------+
5 | This script import cacti xml template files by command line |
6 | Author : Jean Francois Masure <jean-francois.masure@arche.fr> |
7 | Version : 0.1 8 Aug 2005 |
8 +---------------------------------------------------------------------------+
10 include_once("/usr/share/cacti/include/global.php");
11 include_once("/usr/share/cacti/lib/import.php");
13 // check if we have good number of argument
14 if ($argc < 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
15 echo "Usage: $argv[0] FILE.xml [FILE.xml]\n";
16 echo "This script will import FILE.xml template into cacti\n";
21 foreach ($argv as $xml_file) {
22 $xml_data = file_get_contents($xml_file);
23 if ($xml_data === false) {
24 echo "ERROR: cannot open $xml_file, exiting\n";
28 // import data into cacti. $info_array will contain debugging info.
29 echo "cacti-add_template: importing $xml_file\n";
30 $info_array = import_xml_data($xml_data, false);