Closed emeidi closed 6 years ago
It is opposite. You need to untick in Custom Data "IP Adress of Server". Then ds will take IP of your hostname automatically.
@SergejLT The checkbox was ORIGINALLY unticked but it would not provide the variable associated with the device to the script.
That‘s why I had to enable it and to provide the IP by myself for every device. Bummer.
What does the poller cache have for that device? Please provide a copy of it as it shows what it would try and send to the script. Also, it should be noted that you used the field hostname, not ip but as long as that's what you've entered in the hostname field, it should work.
You may also try rebuilding the poller cache.
@SergejLT was correct, you should only tick that box if you want to overwrite a setting. For the ip address of the hostname for example, you should always keep it unticked.
Funny, I am having some problems with this right now myself. For whatever reason the 'hostname' attribute is simply blank no matter what I've tried. Running 1.1.38 and building a new template.
The debug output shows this:
2018/06/26 21:30:47 - SPINE: Poller[1] Device[8] TH[1] DS[84] SCRIPT: perl /cacti/cacti-1.1.38-test/scripts/query_cellwatch.pl --hostname --temperature, output: U
And I have the data input method setup like this:
No idea what is causing this problem. I've rebuilt the poller cache plenty of times. I still get this:
And I have a valid IP address set in the "hostname" field for the device. I've tried with having SNMP enabled, and disabled. No difference. I've deleted and added the host back in several times.
If I change the data input method to use '--hostname 1.2.3.4' it works just fine. It's that the \
Does the standard Unix - Ping Host data query work with this host? That also specifies a hostname field as a parameter.
Yes, the Unix - Ping Host works. But there is an odd bug here. I started to replace parts of the Unix - Ping Host data input method to match my own data input method I was trying to create, and it mostly worked - until I changed "\
And I would bet money that if I change <ip>
to <hostname>
(which is I believe what I did originally to end up here) the whole thing would blow up again.
Interesting analysis. On the field front, the creation of an input field shouldn’t be auto assigning a name. However creation of an output field does as it takes the first that hasn’t been used and sets it accordingly.
Not sure if that was something I did for 1.2 or 1.1.38
I’ll review what you’ve written later and see if I can spot anything.
Oh and if you edit your post, you can use single back ticks around the code so it does not then think you are trying to insert html tags.
Oh, and this is happening firefox, but not in chrome.
Hmm, in that case, I wonder if Firefox is seeing the HTMl fields and doing something with it. Lets check what you have in the database.
[10:33:07] (cacti) cacti1> select * from data_input_fields where data_name = 'hostname';
+----+----------------------------------+---------------+------------+-----------+--------------+------------+----------+-----------+--------------+-------------+
| id | hash | data_input_id | name | data_name | input_output | update_rra | sequence | type_code | regexp_match | allow_nulls |
+----+----------------------------------+---------------+------------+-----------+--------------+------------+----------+-----------+--------------+-------------+
| 29 | 5fbadb91ad66f203463c1187fe7bd9d5 | 10 | IP Address | hostname | in | | 1 | hostname | | |
+----+----------------------------------+---------------+------------+-----------+--------------+------------+----------+-----------+--------------+-------------+
1 row in set (0.00 sec)
[10:33:48] (cacti) cacti1> select * from data_input where id in (10);
+----+----------------------------------+------------------+----------------------------------------------+---------+
| id | hash | name | input_string | type_id |
+----+----------------------------------+------------------+----------------------------------------------+---------+
| 10 | 8bd153aeb06e3ff89efc73f35849a7a0 | Unix - Ping Host | perl <path_cacti>/scripts/ping.pl <hostname> | 1 |
+----+----------------------------------+------------------+----------------------------------------------+---------+
1 row in set (0.00 sec)
In the second query, the (10) is a comma separated list of ids. So if you had three rows from the first query of 1
, 40
and 52
, you would replace (10)
with (1, 40, 52)
. If you do the same queries with both browsers, see if there is any change. The typecode
field of the data_input_field is the important part as that says it is using the hostname (if I remember correctly).
Did you manage to take a look at this @eschoeller ?
Closed due to no further response.
I am just getting back from being on vacation. I may make an effort to wrap my head around this again and respond to your post on 7/1. My apologies for dropping off the radar!
@eschoeller asked me to work on this. Here is the solution for guys who will be stumbling upon this link in the future: First In the (Management -> Devices -> Your Custom Device Name)Device, have the hostname IP correctly indicated In my case, it's localhost (127.0.0.1) as shown in the above pic.
Next in the Data Input Method (Data Collection -> Data Input Methods -> Your custom Data Input Method -> Click on one of the input methods)
In the "Special Type Code" field input "hostname" as shown in the below pic. The input field name is "IP". Now in the Data Sources (Templates -> Data Sources -> Your Custom Data Source Name -> Input Method) data input method, keep the data input method blank Which in my case it is "IP" is kept blank.
Save all and re-check the poller cache. The hostname is detected and passed to your script correctly.
Cacti 1.1.36
Hi Cacti Community
Although I specified an Input Field for a new Data Input Method ...
... and assigned it the device variable
hostname
...... the IP address was not automatically passed to the script by Cacti.
I deleted the graph and data sources created with this template and activated the checkbox in the Data Source template:
Then I recreated the graphs again, for each device.
Now I have to provide the IP address of each device when creating the graphs (which is silly, because Cacti already knows this attribute), but then at least the value gets properly passed to the script.
What am I doing wrong?
Thank you & best regards Mario