Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.63k stars 405 forks source link

RRD not created using a call to create_complete_graph_from_template #3018

Closed arno-st closed 4 years ago

arno-st commented 4 years ago

Hi all, I have a plugin to discover my network, and when I have a link I create some graph of it (traffic and status), for that I'm making a call to create_complete_graph_from_template.

But every think look fine except that the rrd file is not created. For that I have to go to the data source of the device, then just do a save and it do his work and the file is created, then processed as it should be.

And I can't find any reason of why it should act like this. it was working on version 1.x to 1.1x

the only thing I have int the log is: 2019/10/02 14:22:14 - CMDPHP PHP ERROR NOTICE Backtrace: (/graph_json.php[210]:CactiErrorHandler()) 2019/10/02 14:22:14 - ERROR PHP NOTICE: Undefined offset: 1 in file: /usr/share/cacti/graph_json.php on line: 210

When i try to visualize the graph and that's releated to the rra file not existing!

Sorry, we could not process your last action. Error: 200 OK Reason:

Notice: Undefined offset: 1 in /usr/share/cacti/graph_json.php on line 210 {"type":"png","local_graph_id":12718,"rra_id":"0","image":"UlJPUjogb3BlbmluZyAnL3Vzci9zaGFyZS9jYWN0aS9ycmEvcmEtYXVnLTE3NV90cmFmZmljX2luXzEyNjA0LnJyZCc6IE5vIHN1Y2ggZmlsZSBvciBkaXJlY3Rvcnk=","ERROR: opening '\/usr\/share\/cacti\/rra\/ra-aug-175_traffic_in_12604.rrd': No such file or director":""}

tested on : Cacti 1.2.6 Spine 1.2.6 thold 1.0.6 monitor 2.3.5 php 7.2.11 mariadb 5.5.56 Own plugin: ExtendDB 1.1.2 LinkDiscovery 1.2.6 Map 1.2.6

vsevciuc commented 4 years ago

+1

cigamit commented 4 years ago

This was fixed in 1.2.7 or in the 1.2.x branch already. If you sync to the 1.2.x branch and then check back with us if it's still broken, that would be appreciated.

arno-st commented 4 years ago

Sorry still not working, downloaded the 1.2.7 version, and do a call to create_complete_graph_from_template. Here some info: Entry exist into poller_item before.

But still it's look like the rrd file is not created, and I have to go to every data source and clique save, so it it's created.

And I have a threshold for the status interface, setup on the template of the device, so it create every time a threshold for the status. And when I save a device, the threshold do something so the rrd file for the status is created! A call to a function or a call to save the data source

cigamit commented 4 years ago

Okay, so then you need to do two things:

1) Create the graph, and then in the broken state, dump the database to a file. 2) Save the device, and dump the database again to another file.

Then we can diff the two files. Use the following syntax:

mysqldump --lock-tables=false --skip-extended-insert cacti > dumpfileXX.sql

Then, send the diff. You should edit out the poller_output table. If you can do the dump's between polling cycles even better.

arno-st commented 4 years ago

Hmm somthing change, I can't anymore recreate the RRD with a save device, not a save data source.

I have to dump file, but the diff is hugue, since every device has a different uptime. i will remove all device except 1 or 2

arno-st commented 4 years ago

so here is 2 dumpfiles. The first one is created after the device where created, and when the rra should have been also created. Then the second file, is when I did a save on the device, and on the data source. dumpfile.zip

arno-st commented 4 years ago

By the way, I can see the graph but the RRD is empty, so NAN for the graph

arno-st commented 4 years ago

The problem is higher of what I expected, since I take one of my device, and select an interface, and do a create graph for it. Nothing Happen, except the message that the action was done! but no rrd file nor graph

and no error except: ERROR: opening '/usr/share/cacti/rra/se-pama-2020_traffic_in_14144.rrd': No such file or directory on the graph on the device. And user right on file and folder are ok. Even doing a save on the device did brig the rrd file!

arno-st commented 4 years ago

Dumpe file of the DB at diffrent stage, dumpfile2.zip

arno-st commented 4 years ago

oups sorry RRD file where created, 15minutes after the request ! My crontab is at 5minutes

arno-st commented 4 years ago

I also saw that if I rebuild the poller cache, I go from 53 to 84 record in the poller_item table, and most of the supposed to be traced graph where not in the DB. But still RRD file not created!!

arno-st commented 4 years ago

Any news on this point ?

netniV commented 4 years ago

Not at this point, we are hoping to get back on track from personal sickness/issues that's affected different members of the group by the end of the week

arno-st commented 4 years ago

Still not fixed in 1.2.8 and not duplicate as Cigamit say in octobre !!

Anychance it will be fixed from someone ?

netniV commented 4 years ago

Can you supply exactly what data you are passing to the function? The important field is the data_source_path in the data_template_data table so I would like to know how that is or isn't getting populated.

The function generate_data_source_path does the work of populating the data source path, and that is call primarily from get_data_source_path in lib/functions.php. So the question is whether the function is never called which can happen if it believes data has already been set for it, or if the cache was already populated with data thinking it was set.

function get_data_source_path($local_data_id, $expand_paths) {

   ...

        if (isset($data_source_path_cache[$local_data_id])) {
                return $data_source_path_cache[$local_data_id];
        }

        $data_source = db_fetch_row_prepared('SELECT ' . SQL_NO_CACHE . ' name, data_source_path FROM data_templat$

        if (cacti_sizeof($data_source) > 0) {
                if (empty($data_source['data_source_path'])) {
                        /* no custom path was specified */
                        $data_source_path = generate_data_source_path($local_data_id);
                } elseif (!strstr($data_source['data_source_path'], '/')) { 
                        $data_source_path = '<path_rra>/' . $data_source['data_source_path'];
                } else {
                        $data_source_path = $data_source['data_source_path'];
                }
arno-st commented 4 years ago

Ok here is the call I made to this function: create_complete_graph_from_template( $graph_template_id, $seedhostid, $snmp_query_array, $empty); $graph_template is the id of the template $seedhostid is the ID of the host I need to create graph for $snmp_query_array is an array with: $snmp_query_array["snmp_query_id"] = $snmp_query_id; $snmp_query_array["snmp_index_on"] = get_best_data_query_index_type($seedhostid, $snmp_query_id); $snmp_query_array["snmp_query_graph_id"] = $snmp_query_graph_id; $snmp_query_array["snmp_index"] = $src_intf; here is a log for an interface graph creation: ["snmp_query_id"]=> string(1) "1" ["snmp_index_on"]=> string(6) "ifName" ["snmp_query_graph_id"]=> string(2) "23" ["snmp_index"]=> string(2) "34"

$empty, is just an empty array

Into cacti I can see the data source, I can see the graph, but no rrd file are created

netniV commented 4 years ago

I'll try and take a look at the weekend. Not sure if I'll have time before that.

arno-st commented 4 years ago

it's look like I have to make a call to push_out_host and then the rrd file are created!

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.