Closed Fireball2k15 closed 6 years ago
Is the field in the Input section of your data query? What definition does it have?
Hi, yes ist is in the input section. To dubble check that I do not ma a mistake, I added to an existing Data Input Method (Unix Ping) an additional field (snmp_community). It has the same effect - the second field is not appandet and not shown in the poller cache. I've exported both Data Templates, maybe you are able to find out what is wrong.
cacti_data_templateunix-_ping_host.zip
I although add here a screenshot of the poller Table.
Thank you for your help. Fireball
Did you rebuild the pollen cache after making the changes?
Yes I did. I dubblecheckt and rebuild again - same result. Fireball
OK, I'm not able to today but I'll create some SQL for you to double check in the next day or so
Hi, this is quite ok for me. Actually I have a working version. But I assume there is a bug that prevent using inputfield proper.
Fireball
OK, first lets find the ID of your data_input. You can do this by editing the input method in the GUI and noting the ID number, or using the following SQL query (replacing ucd/net for something in your data input name):
select id,name from data_input where name like '%ucd/net%'
Assuming you can pick your method note the id and replace the id=15 on any subsequent queries with your id. First thing is to get your data input input_string by using:
select input_string from data_input where id = 15;
Again, this should marry up with what you are seeing on your screen. One thing i think happens now is that parameters these days are encompassed in single quotes when passed through to a query. So if you combined two parameters, they should have a space to send them separately.
Now, lets check your fields are present
select * from data_input_fields where data_input_id = 15 order by input_output,sequence;
This will show you the fields in order by sequence, grouped by 'in' and 'out'. If you can, paste the output to these queries in a code block and then we can see what is being used.
Hi, here the output: `MariaDB [cacti]> select id,name from data_input where name like '%ing%'; +----+------------------+ | id | name | +----+------------------+ | 10 | Unix - Ping Host | +----+------------------+ 1 row in set (0.00 sec)
MariaDB [cacti]> select input_string from data_input where id = 10;
+---------------------------------------------------------------+
| input_string |
+---------------------------------------------------------------+
| perl
MariaDB [cacti]> select * from data_input_fields where data_input_id = 10 order by input_output,sequence; +-----+----------------------------------+---------------+----------------------------+----------------+--------------+------------+----------+----------------+--------------+-------------+ | 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 | | | | 109 | 0726fb5531b05c1c7661500f287fb7ef | 10 | snmp community of the host | snmp_community | in | | 2 | snmp_community | | | | 30 | 6ac4330d123c69067d36a933d105e89a | 10 | Milliseconds | out_ms | out | on | 0 | | | | +-----+----------------------------------+---------------+----------------------------+----------------+--------------+------------+----------+----------------+--------------+-------------+ 3 rows in set (0.00 sec) `
Fireball
That value in data_input table is not correct. Should be the special type code of <hostname>
and not <snmp_community>
.
You likely got this when importing a template from the forums or elsewhere. It would be nice if you could trace the template you imported and let us know here and in the forums.
To correct this, just simply edit the Data Input Method, and change that one setting. You may have to either re-populate the poller cache, or resave the device to get the changes into the poller_items table.
In the future, always 'preview' the template before importing templates.
Hi cigamit, yes you are right, for this script snmp_community makes no sense. I tryed to show that if you add input parameters to a script is not working. Just to be shure that I do not make any mistake with my script I used an existing, where although one parameter is used. Therefor I modyfied the ping script. You can checkt this by your self if you try to create a new script with an input parameter.
Fireball
Is SNMP community actually set for the device you've run this against? Setting that as a parameter won't work if there is no SNMP setup against that device.
Yes, the snmp community is set. I although checked this with a paramater that I had to enter manuelly - it is not insert in the poller.
Hi, I've tried to reproduce the behavior on an new installed system. This time it worked well for me. Therefor I'll close this issue.
Fireball
Hi I tryed to build an net Data Input Method using Script/Command. I insered the path to my script and although two variables "/scripts/Function.sh GetUsvValuesViaSnmp "
I declared the two Input Variables as usual - but in the Poller Cache the two variables are not appended.
When I export the exactly same Data Imput Method from a older Cacti 0.88f it works fine.
used environment: