Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


XMLPort 0.3.5 - Bulk Template Importer/Exporter/Archiver

 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin Announcements
Author Message
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Wed Jun 25, 2008 2:22 pm    Post subject: XMLPort 0.3.5 - Bulk Template Importer/Exporter/Archiver Reply with quote

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.



xmlport-0.3.5.tar.gz
 Description:
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.

Download
 Filename:  xmlport-0.3.5.tar.gz
 Filesize:  22.28 KB
 Downloaded:  103 Time(s)



Last edited by streaker69 on Tue Jul 15, 2008 7:50 pm; edited 9 times in total
Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Thu Jun 26, 2008 6:49 pm    Post subject: Reply with quote

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.
Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Fri Jun 27, 2008 8:50 pm    Post subject: Reply with quote

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.
Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Mon Jun 30, 2008 10:51 am    Post subject: Reply with quote

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.
Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Wed Jul 09, 2008 8:42 am    Post subject: Reply with quote

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.
Back to top
X-dark



Joined: 18 Jun 2008
Posts: 13

PostPosted: Tue Jul 15, 2008 8:35 am    Post subject: Reply with quote

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
Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Tue Jul 15, 2008 8:36 am    Post subject: Reply with quote

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
Back to top
X-dark



Joined: 18 Jun 2008
Posts: 13

PostPosted: Tue Jul 15, 2008 8:59 am    Post subject: Reply with quote

no I don't see anything there
Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Tue Jul 15, 2008 9:00 am    Post subject: Reply with quote

X-dark wrote:
no I don't see anything there


Did you enable it under the users configuration?
Back to top
X-dark



Joined: 18 Jun 2008
Posts: 13

PostPosted: Tue Jul 15, 2008 9:03 am    Post subject: Reply with quote

No
Now it's ok. Thanks
Back to top
X-dark



Joined: 18 Jun 2008
Posts: 13

PostPosted: Tue Jul 15, 2008 9:06 am    Post subject: Reply with quote

There is a bug when the user has no right in the xmlport folder :
Code:
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 />
^
Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Tue Jul 15, 2008 9:27 am    Post subject: Reply with quote

X-dark wrote:
There is a bug when the user has no right in the xmlport folder :
Code:
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.
Back to top
bodo.bach



Joined: 02 Jul 2008
Posts: 9

PostPosted: Sun Aug 03, 2008 7:51 am    Post subject: Question Reply with quote

Nice addon to Cacti.....
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 945
Location: B/CS Texas

PostPosted: Sun Sep 07, 2008 2:35 pm    Post subject: Reply with quote

Nice plugin, does it have the ability to import via the command line?
Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Sun Sep 07, 2008 3:50 pm    Post subject: Reply with quote

cigamit wrote:
Nice plugin, does it have the ability to import via the command line?


Nope.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin Announcements All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group