XMLPort 0.3.5 - Bulk Template Importer/Exporter/Archiver

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

XMLPort 0.3.5 - Bulk Template Importer/Exporter/Archiver

Post by streaker69 »

Took most of the day, but I succeeded in writing a Bulk Exporter for all the different templates. It's based on the Template_Export.php file that comes with cacti with a bunch of modifications.

I'm not a php programmer, so I pretty much fumbled my way through this, it works fine on my machine, hopefully it will work on everyone else's as well.

Basically it gives you the choice of the four types of XML files you can export, displays the list of them and then you hit the Create button and it exports them to directories inside the plugin directory.

Maybe sometime in the future I can write a scheduler for it, but for now it works, just install it like any other plugin.

Please post here if you have questions or issues, I'll do what I can to resolve them.
Attachments
xmlport-0.3.5.tar.gz
Version 0.3.5 7/15/2008

Added check if directories are writable by Cacti User.

Minor path fixes on tools, resolved issue with version changes not being detected.
(22.28 KiB) Downloaded 1121 times
Last edited by streaker69 on Tue Jul 15, 2008 7:50 pm, edited 9 times in total.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

New version, now with Tint Control!!

Just kidding, I've added a couple of new features. I removed the Top tab bar navigation, I didn't think that was needed. I've moved it to the Import/Export area of the console.

I've also added Importing from the local storage area. So you can do a mass export, and then selectively import the files back in.

This PHP stuff isn't too hard now that I'm not doing all my editing in Nano, someone turned me onto jEdit today, so it's been a little easier learning this.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

Another new version.

I added the feature that you can now create a Zip or Tar.Gz file of your Templates and then download them in bulk.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

Hopefully I'm not driving you guys nuts with updating this after you've downloaded it. I'm teaching myself PHP and as I learn more, I've been trying to add features I had been thinking of from the start.

Today's change is a minor one. I neglected to mention previously that you'd need Archive_tar and Archive_zip installed in Pear to use the Archive function. Hopefully you guys that downloaded it figured it out and installed it.

I've made a change to the Setup.php file to give file boxes to where your Tar.php and Zip.php files are located. It checks for those files before you attempt to archive anything, if they're not there, it will prompt you to update the settings page.

I'm looking for feedback, whether good or bad, so if you have ideas on improvements or issues, please post here.

thank you.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

Uploaded a new version. I found a bug in one file where I hardcoded a path. Fixed that bug. The only file you need to replace in your plugin is xmlimport.php.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
X-dark
Cacti User
Posts: 111
Joined: Wed Jun 18, 2008 10:21 am
Location: France

Post by X-dark »

I'm testing your plugin but I don't see how to use it. The only thing I've found is how to set the path to the Tar.php and Zip.php file
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

X-dark wrote:I'm testing your plugin but I don't see how to use it. The only thing I've found is how to set the path to the Tar.php and Zip.php file
Under the Import/Export section of the Console, you should see XMLPort
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
X-dark
Cacti User
Posts: 111
Joined: Wed Jun 18, 2008 10:21 am
Location: France

Post by X-dark »

no I don't see anything there
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

X-dark wrote:no I don't see anything there
Did you enable it under the users configuration?
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
X-dark
Cacti User
Posts: 111
Joined: Wed Jun 18, 2008 10:21 am
Location: France

Post by X-dark »

No :(
Now it's ok. Thanks
X-dark
Cacti User
Posts: 111
Joined: Wed Jun 18, 2008 10:21 am
Location: France

Post by X-dark »

There is a bug when the user has no right in the xmlport folder :

Code: Select all

XML Parsing Error: junk after document element
Location: http://192.168.1.250/graphs/plugins/xmlport/xmlsave.php
Line Number 2, Column 1:<b>Warning</b>:  fopen(./plugins/xmlport/graph_template/cacti_graph_template_asterisk_-_active_calls.xml) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/var/www/graphs/plugins/xmlport/xmlsave.php</b> on line <b>22</b><br />
^
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

X-dark wrote:There is a bug when the user has no right in the xmlport folder :

Code: Select all

XML Parsing Error: junk after document element
Location: http://192.168.1.250/graphs/plugins/xmlport/xmlsave.php
Line Number 2, Column 1:<b>Warning</b>:  fopen(./plugins/xmlport/graph_template/cacti_graph_template_asterisk_-_active_calls.xml) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/var/www/graphs/plugins/xmlport/xmlsave.php</b> on line <b>22</b><br />
^
hmm, yeah.. I guess that's why the general rule of Cacti has always been that plugin directory should be Chown'ed to the user that's running Cacti.

I'll try to fix the plugin that it checks to see if the folder is writable in the future, right now I got a few other fish to fry.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
bodo.bach
Posts: 9
Joined: Wed Jul 02, 2008 7:35 am

Question

Post by bodo.bach »

Nice addon to Cacti.....
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Nice plugin, does it have the ability to import via the command line?
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

cigamit wrote:Nice plugin, does it have the ability to import via the command line?
Nope.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests