Cacti / plugin_reportit

ReportIt Plugin for Cacti
GNU General Public License v2.0
7 stars 9 forks source link

cc_view.php not found or unable to stat #21

Closed gmourani closed 6 years ago

gmourani commented 6 years ago

Hello,

Cacti version 1.1.38 Reportit version 1.0.0

When trying to import xml template, nothing happen when clicking on the "Upload" button and there is an error in Apache log file related to a missing 'cc_view.php' file!

[Fri Jun 08 09:13:57 2018] [error] [client 192.168.2.147] script '/var/www/html/cacti/plugins/reportit/cc_view.php' not found or unable to stat, referer: https://192.168.2.227/cacti/settings.php?tab=reports&

netniV commented 6 years ago

I'm not sure where you got your version of reportit from, but cc_view.php isn't part of reportit within the github sources so it isn't reportit that is calling that. Can you provide the URL and screenshot of the import function you are trying to use?

gmourani commented 6 years ago

I know cc_view.php is not part of reportit 1.0.0 but it's part of old version of reportit. I've installed latest version of reportit from github and tried to import my xml files from older reportit version into this new version when this Apache error related to cc_view.php happened.

screen shot 2018-06-08 at 1 25 48 pm
gmourani commented 6 years ago

It's possible to import the XML file in CLI ?

netniV commented 6 years ago

Do you have a copy of the report template?

gmourani commented 6 years ago
<?xml version="1.0" encoding="UTF-8"?>
<cacti>
    <report_template>
        <reportit>
            <version>0.7.5a</version>
            <type>1</type>
            <hash>c511cd15074b384c899249479a3ae7de</hash>
        </reportit>
        <general>
            <description>Traffic Template</description>
            <author>GM</author>
            <version>1</version>
            <contact>root@localhost</contact>
        </general>
        <settings>
            <id>5</id>
            <description>Default Traffic Template rev.0.1</description>
            <pre_filter></pre_filter>
            <data_template_id>41</data_template_id>
            <locked>0</locked>
            <export_folder></export_folder>
        </settings>
        <measurands>
            <measurand>
                <id>16</id>
                <template_id>5</template_id>
                <description>Last Measured Value</description>
                <abbreviation>LAST</abbreviation>
                <calc_formula>f_last*8</calc_formula>
                <unit>Bits/s</unit>
                <visible>1</visible>
                <spanned>0</spanned>
                <rounding>2</rounding>
                <cf>1</cf>
                <data_type>1</data_type>
                <data_precision>2</data_precision>
            </measurand>
            <measurand>
                <id>17</id>
                <template_id>5</template_id>
                <description>Average Traffic in Bits/s</description>
                <abbreviation>AVG</abbreviation>
                <calc_formula>f_avg*8</calc_formula>
                <unit>Bits/s</unit>
                <visible>1</visible>
                <spanned>0</spanned>
                <rounding>2</rounding>
                <cf>1</cf>
                <data_type>1</data_type>
                <data_precision>2</data_precision>
            </measurand>
            <measurand>
                <id>18</id>
                <template_id>5</template_id>
                <description>Maximum Traffic in Bits/s</description>
                <abbreviation>MAX</abbreviation>
                <calc_formula>f_max*8</calc_formula>
                <unit>Bits/s</unit>
                <visible>1</visible>
                <spanned>0</spanned>
                <rounding>2</rounding>
                <cf>1</cf>
                <data_type>1</data_type>
                <data_precision>2</data_precision>
            </measurand>
        </measurands>
        <variables>
        </variables>
        <data_source_items>
            <data_source_item>
                <id>0</id>
                <template_id>5</template_id>
                <data_source_name>overall</data_source_name>
                <data_source_alias></data_source_alias>
            </data_source_item>
            <data_source_item>
                <id>54</id>
                <template_id>5</template_id>
                <data_source_name>traffic_in</data_source_name>
                <data_source_alias>Inbound Traffic</data_source_alias>
            </data_source_item>
            <data_source_item>
                <id>55</id>
                <template_id>5</template_id>
                <data_source_name>traffic_out</data_source_name>
                <data_source_alias>Outbound Traffic</data_source_alias>
            </data_source_item>
        </data_source_items>
    </report_template>
</cacti>
gmourani commented 6 years ago

I can't attach an XML file to this message.

netniV commented 6 years ago

I edited your post so that the email displays. If you look at it, you'll see how to use the format in future 👍

I'll take a look at this and see what I can see.

gmourani commented 6 years ago

Thanks, I can't found nothing in the XML that related to old cc_view.php file. I don't know from where it try to call cc_view.php when uploading an XML. Maybe an old entry that stay in the database even after update ?

netniV commented 6 years ago

I think cc_view.php was in a previous version of ReportIT as it was present in 0.7.5. What I would do if I was you, is rename the folder containing the plugin right now to a .old or something else. Then download the latest release from the Code->Releases tab here. Extract that to the "reportit" folder and then ensure that ReportIt is properly enabled in the plugin's section.

It's possible you have been using an older page which still contains the cc_view.php link. If you migrated your data from an even earlier version of cacti, it's possible that it is within the database so check the tables too.

gmourani commented 6 years ago

Yes, cc_view.php was in previous version. I've already removed the old reportit folder and replaced it with the latest. I've checked inside the BD and nothing related to cc_view inside! I think the import and export part of the reportit plugin have some bug.

netniV commented 6 years ago

Well, it's definitely not in the code that we have here in the repository. Could you post the URL that you are using to import?

gmourani commented 6 years ago

https://192.168.2.227/cacti/plugins/reportit/templates.php?action=template_upload_wizard

netniV commented 6 years ago

Did you manage to resolve this @gmourani ?

gmourani commented 6 years ago

The way I've managed it was to recreate the templates manually. Not able to import the xml file.

netniV commented 6 years ago

If you export the template and reimport, does that do the same thing?

gmourani commented 6 years ago

Cannot test this part because exporting the new template return another error related to Undefined index. See attached screenshot.

screen shot 2018-07-04 at 10 27 59 am
netniV commented 6 years ago

Strange, that error would suggest that there is no data_template_id being set. It's also strange, because that line of code is in the edit section called by having the action variable set to template_edit whereas when you are exporting that should be template_export_wizard