From 5c2a654735813597d862942f28cf77e20c72c4ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Sun, 5 Oct 2008 12:11:57 +0000 Subject: [PATCH] - add to SOURCES Changed files: cacti-add_template.php -> 1.1 --- cacti-add_template.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 cacti-add_template.php diff --git a/cacti-add_template.php b/cacti-add_template.php new file mode 100644 index 0000000..bd969d2 --- /dev/null +++ b/cacti-add_template.php @@ -0,0 +1,35 @@ +#!/usr/bin/php + | +| Version : 0.1 8 Aug 2005 | ++---------------------------------------------------------------------------+ +*/ +include_once("/usr/share/cacti/include/global.php"); +include_once("/usr/share/cacti/lib/import.php"); + +// check if we have good number of argument +if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) +{ + echo "usage : $argv[0] file.xml\n"; + echo "this script will import file.xml template into cacti\n"; + return 0; +} + +// open the .xml file +$xml_file = $argv[1]; +$fp = fopen($xml_file, "r"); +if ($fp == FALSE) +{ + echo "cannot open $xml_file, exiting\n"; + return -1; +} +$xml_data = fread($fp,filesize($xml_file)); + +// import data into cacti. $info_array will contain debugging info. +$info_array = import_xml_data($xml_data,false); + +return 0; +?> -- 2.43.0