Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Jul 28, 2017 12:11 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: New plugin: creating device, community comes from other DB
PostPosted: Wed Jun 15, 2011 6:09 am 
Offline

Joined: Wed Jun 15, 2011 6:00 am
Posts: 2
Hello all,

First I want to tell you how much i am happy with this tool cacti.
I wrote few little pluggins:
1 - to manage automatically the deployment of the templates...
When installing this pluggins, all templates validated by me are propagated into cacti instances.
2 - a personal rrd cleanup where the cleanup parameters are stored also on cacti settings tab.
3 - a plugin which informs me when the amount of devices or graphs reatch the maximum limit setup also into the setting table.
4 - I am trying to complete a plugin which simplify the device creation.
In cacti previous version 0.8.6 i had it working. today i want to have that into the plugin architecture.
I am trying to write a pluggin which fills automatically the community string...

The goal is to show only the host template, the name, Description, Community string fields and disabled button into the edit host page.
When the user is typping a device name, This pluggin lookup the matched devices list into a remote database.
When the user select one device, the description and community string is automatically populated...

The external DB parameter are stored into the cacti settings table... using config_settings table.
The lookup is developped on Cajax framework....this javascript is called and associated to the cacti fields into the top_header hook ...
I try to use the config_form hook to hide all others fields, the goal is to get them from the read_config function based on the cacti settings table.

I have difficulties to get this part working properly.

How can I not show all device edit page field ....?
I try to use the config_form hook but without good success ...


using
on pluggin hook config_form
$fields_host_edit = array( "method" => "hidden",
"value" => read_config_option("snmp_port")
);
I get error:
document.GetElementById("snmp_port") is null on the host.php file

Can someone help me ?

which hook plugin can i use....? to be able to hide some fields ? and to populate them from the default cacti config ?
Which ones are really mandatory ?


Best regards
A.DB


Attachments:
File comment: Here is the illustration
auto-completion.JPG
auto-completion.JPG [ 109.45 KiB | Viewed 3058 times ]
Top
 Profile  
 
 Post subject: Re: New plugin: creating device, community comes from other
PostPosted: Tue Jun 21, 2011 2:14 am 
Offline

Joined: Wed Jun 15, 2011 6:00 am
Posts: 2
AnyOne ?


Top
 Profile  
 
 Post subject: Re: New plugin: creating device, community comes from other
PostPosted: Sat Oct 01, 2011 12:41 pm 
Offline
Developer
User avatar

Joined: Tue May 14, 2002 5:08 pm
Posts: 14863
Location: MI, USA
Makes no sense.

_________________
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
Gandalfs Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Re: New plugin: creating device, community comes from other
PostPosted: Thu Dec 15, 2011 12:56 am 
Offline
Developer

Joined: Thu Apr 07, 2005 3:29 pm
Posts: 2591
Location: B/CS Texas
The problem with the approach you were using (utilizing config_form to modify the array that contains the host fields) is that there is a good bit of hardcoded javascript at the end of the host page that tries to make everything all ajax-ish. Ideally, we would have that code change based upon the actual fields, but for what you want to do, I would suggest this. Detect when host.php page is shown (use the top_header hook) and then do your own top_header and spit out your own code for the edit page.

_________________
CactiEZ CD


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group