How to change the host_template setting for a host using cli

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Swordfish
Posts: 15
Joined: Tue Feb 21, 2006 9:00 pm
Location: Melbourne, Victoria, Australia

How to change the host_template setting for a host using cli

Post by Swordfish »

Hi,

We are running:
Cacti Version 0.8.7h
Red Hat Enterprise Linux Server release 5.7 (Tikanga)

I have a large number of hosts that need to have the host template changed to a new host_template.

I have looking in the "cli" folder and found what I think can help - "host_update_template.php"
So far I have not seen the desired result using this script.

The help for the command below is also somewhat confusing.

Code: Select all

<snip>
Cacti Retemplate Host Script 1.0, Copyright 2004-2011 - The Cacti Group
usage: host_update_template.php -host-id=[host-id|All] [--host-template=[ID]] [-d] [-h] [--help] [-v] [--version]

--host-id=host_id  - The host_id to have templates reapplied 'all' to do all hosts
--host-template=ID - Which Host Template to Refresh

<snip>
The "to have templates reapplied" suggests applying a template - but maybe not changing it.
The "Which Host Template to Refresh" is confusing - unless the script allowed changing the host template.

To better explain myself; given that a host has a host_template assigned already, what purpose would there be to refresh anything other than the existing host_template; so why specify it on the command line?
Conversely; if the intention of specifying the host_template was to allow changing the host's host_template; then it does not do that.

Can someone clarify my observations above so that I can understand.
Secondly, my need is to change the host_template on 91 hosts; how do you do this via command line.

Thank you in advance.

PS. If the answer is in the forums; I could not find it because a search for change host template command line cli (and other similar) returned:
Search term used: change host template command line cli ignored: command change line host template
Which excludes 99% of what I'm looking for. !!

Thanks, Swordfish.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: How to change the host_template setting for a host using

Post by gandalf »

Currently, when changing a host template by adding a new graph template, those changes are NOT propagated to the related hosts. To rectify this, the cli script in question was created. For your request, I fear we do not have a cli yet.
R.
Swordfish
Posts: 15
Joined: Tue Feb 21, 2006 9:00 pm
Location: Melbourne, Victoria, Australia

Re: How to change the host_template setting for a host using

Post by Swordfish »

Thanks Gandalf,

I see the subtleties of the "refresh" now.

Sounds like I'll be walking the MYSQL tables to find my solution.

Can I ask, the CLI command to do my request go on the to-do list?

For us large users of Cacti; being able to administer Cacti via CLI has significant advantages and time savings.


RHEL 5.7 x64
Cacti 0.8.7h
Hosts: 1875
Graphs: 79216
DataSources: 85074
Poller Run Time: 165 seconds average

And growing day by day.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: How to change the host_template setting for a host using

Post by gandalf »

I was thinking about using add_device.php, providing the new host_template_id. Cacti then should associate that and run all related data_queries. It will not create any graphs (unless you're using AUTOM8)
R.
Swordfish
Posts: 15
Joined: Tue Feb 21, 2006 9:00 pm
Location: Melbourne, Victoria, Australia

Re: How to change the host_template setting for a host using

Post by Swordfish »

Hi Gandalf,

That would be great.
We already Add a host and then Add it's graphs via a different script, anyway, so I see that as no different.

What was your intention for release of that updated add_device.php ? :wink:

Swordfish.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: How to change the host_template setting for a host using

Post by gandalf »

Sorry for not being clear. I was assuming, that using this parameter NOW will work as described. I'm not sure THAT it works, so please check out.
All scripts are being reworked for one of the next releases and then you will have that very update feature
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests