Data Input Method - Only <host> is working

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Author
Message
MrLINK
Posts: 2
Joined: Mon Aug 12, 2013 4:13 am

Data Input Method - Only <host> is working

#1 Post by MrLINK » Mon Aug 12, 2013 4:36 am

(cacti 0.8.8a)

Hi,

I try to get a script working with my cacti (allready read http://docs.cacti.net/manual:087:3a_adv ... ut_methods).

My primary intention was to pass the host_description variable of a device to an external script, but I read in some forums, that this is not possible. I cannot use the <host> vairable, because the devices are the localhost (127.0.0.1) :)

So, the devices are "virtual" devices on the localhost, however I want do distinguish each one of them, finally in my script. To be more precisely: The script schould read several files in which the files are selected by name (optimally by the host_description variable of cacti).

No I set a snmp community to one of the devices. I also set an input string:

Code: Select all

perl /usr/share/cacti/scripts/spannung2.pl <snmp_community>
In addition, I set the Input Field:

Code: Select all

Field Input]: snmp_community
Firendly Name: snmp_community
Special Type Code: snmp_community

(rest is empty)
If the data gets polled, no value is passed:

Code: Select all

08/12/2013 11:30:03 AM - CMDPHP: Poller[0] Host[3] DS[27] CMD: perl /usr/share/cacti/scripts/spannung2.pl , output: 5
(the "output: 5" returned by my script is ok, used for testing)

I hope you can help me in the case.

Thanks in advance!

MrLINK
Posts: 2
Joined: Mon Aug 12, 2013 4:13 am

Re: Data Input Method - Only <host> is working

#2 Post by MrLINK » Mon Aug 12, 2013 9:33 am

I think I solved it bei myself. To my understanding the snmp has to work to query the snmp variables. Therefore I checked the host template of a device and enabled snmp on my localhost.

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

Re: Data Input Method - Only <host> is working

#3 Post by gandalf » Mon Aug 12, 2013 4:06 pm

MrLINK wrote:I think I solved it bei myself. To my understanding the snmp has to work to query the snmp variables. Therefore I checked the host template of a device and enabled snmp on my localhost.
Yes
R.

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

Re: Data Input Method - Only <host> is working

#4 Post by gandalf » Mon Aug 12, 2013 4:08 pm

MrLINK wrote:My primary intention was to pass the host_description variable of a device to an external script, but I read in some forums, that this is not possible.
That hint was wrong. There's a whole set of host variables, which can be used. But you'll have to list those you want to use from this set and pass them to your script. You do this in the data input method by adding e.g. <host_description> as a pseude variable on the command line for your script.
All this is documented and explained via a walkthrough at 1st link of my sig
R.

Post Reply