Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please update plugin for Cacti 1.0.0 version #58

Closed
pautiina opened this issue Feb 1, 2017 · 84 comments
Closed

Please update plugin for Cacti 1.0.0 version #58

pautiina opened this issue Feb 1, 2017 · 84 comments
Assignees

Comments

@pautiina
Copy link
Contributor

pautiina commented Feb 1, 2017

Now being actively development of new Cacti 1.0.0. Please help prepare for Cacti 1.0.0 Release
https://github.com/Cacti/cacti/issues/249
I have plugin 0.98a with my change. This pugin work on Cacti 1.0.0 and have new api, but I not a programmer and my change plugin have some mistake.
weathermap.zip

@howardjones
Copy link
Owner

Where did you get documentation for Cacti 1.0 plugins? It seemed to be a complete rewrite to make Weathermap work with 1.0...

Also, I can't see what you changed in this zip file apart from adding the INFO file.

@howardjones howardjones self-assigned this Feb 2, 2017
@pautiina
Copy link
Contributor Author

pautiina commented Feb 2, 2017

I not have documentation for Cacti 1.0 plugins. I'm look for logs and find problem, than i find new function in Cacti 1.0 and change plugin weathermap for new function.

@howardjones
Copy link
Owner

OK, but which function? I can't just unzip your zip file over the top of my copy without knowing what the changes are. In Github, you should usually make a pull request with the changes. I at least need to know what you changed...

@pautiina
Copy link
Contributor Author

pautiina commented Feb 2, 2017

It's my change plugin. repack
weathermap.zip
It's patch
network-weathermap-patch.zip

@howardjones
Copy link
Owner

howardjones commented Feb 2, 2017

Thanks, I'll take a look at the patch, (and Cacti 1.0!)

Github pull requests are still the best/correct way to do this, though, for the future

@YATV
Copy link
Contributor

YATV commented Feb 2, 2017

Where did you get documentation for Cacti 1.0 plugins? It seemed to be a complete rewrite to make Weathermap work with 1.0...

https://github.com/Cacti/cacti/wiki/PluginMigration

@cigamit
Copy link

cigamit commented Feb 4, 2017

Here is something that I have done to make Weathermap functional in Cacti 1.0. However, it looks like Howie is looking at a much larger refactor. This effort took about 8 hours, and could be redone. Things that were completed in this patch include:

  • Migration to Cacti 1.0 plugin design
  • i18n of all (or most) GUI elements
  • Ajax callbacks as applicable
  • Remove colors array and implement Cacti classes
  • Some minor cleanup
  • Some less minor style changes

plugin_weathermap.zip

I believe this is based upon Weathermap 0.98a.

Howie, if I were to do this again, what branch should I do it in? If you can let me know, I'll work on a pull request.

@howardjones
Copy link
Owner

howardjones commented Feb 4, 2017

Thanks cigamit! I'm a bit confused - how do you not know where the source came from?

No worries about putting more time into it - I'll take a look at this... the database-refactor branch is the actual current code. At first glance, it looks like you got the right one (WeathermapManager and the PDO stuff doesn't exist in any other branch).

@cigamit
Copy link

cigamit commented Feb 4, 2017

I followed breadcrumbs from the bug logged on the Cacti GitHub back to here. The user pautiina left a zip file that I used as a starting point. I know now that it was the refactor branch. Please note that there is an error in setup.php line 589. Remove the space between index.php:, weathermap-cacti-plugin-mgmt.php:. I also noted that there is a syntax error Tests/WeathermapManagerTest.php.

There may be other issues that have not been addressed, but it's pretty much converted with essentially the current functionality.

@pautiina
Copy link
Contributor Author

pautiina commented Feb 4, 2017

  1. I have added some images that in its current version of Cacti not present.
  2. Now have error (bug), when I click for link on weathermap and go to Graph.
2017-02-05 01:11:22 - ERROR PHP NOTICE: Undefined index: weathermap-cacti-plugin.php:view in file: /var/www/cacti/lib/functions.php  on line: 2733
2017-02-05 01:11:22 - CMDPHP PHP ERROR NOTICE Backtrace: (/graph.php: 48 top_graph_header)(/lib/functions.php: 3312 include)(/include/top_graph_header.php: 63 draw_navigation_text)(/lib/functions.php: 2733 CactiErrorHandler)(/lib/functions.php: 4238 cacti_debug_backtrace)
2017-02-05 01:11:22 - ERROR PHP NOTICE: Undefined index: weathermap-cacti-plugin.php:view in file: /var/www/cacti/lib/functions.php  on line: 2734
2017-02-05 01:11:22 - CMDPHP PHP ERROR NOTICE Backtrace: (/graph.php: 48 top_graph_header)(/lib/functions.php: 3312 include)(/include/top_graph_header.php: 63 draw_navigation_text)(/lib/functions.php: 2734 CactiErrorHandler)(/lib/functions.php: 4238 cacti_debug_backtrace)
2017-02-05 01:11:22 - ERROR PHP NOTICE: Undefined index: weathermap-cacti-plugin.php:view in file: /var/www/cacti/lib/functions.php  on line: 2733
2017-02-05 01:11:22 - CMDPHP PHP ERROR NOTICE Backtrace: (/graph.php: 48 top_graph_header)(/lib/functions.php: 3312 include)(/include/top_graph_header.php: 123 draw_navigation_text)(/lib/functions.php: 2733 CactiErrorHandler)(/lib/functions.php: 4238 cacti_debug_backtrace)
2017-02-05 01:11:22 - ERROR PHP NOTICE: Undefined index: weathermap-cacti-plugin.php:view in file: /var/www/cacti/lib/functions.php  on line: 2734
2017-02-05 01:11:22 - CMDPHP PHP ERROR NOTICE Backtrace: (/graph.php: 48 top_graph_header)(/lib/functions.php: 3312 include)(/include/top_graph_header.php: 123 draw_navigation_text)(/lib/functions.php: 2734 CactiErrorHandler)(/lib/functions.php: 4238 cacti_debug_backtrace)

8

  1. Automatically cycle also not working
  2. When i opent editor in Cacti log have error:
2017-02-05 01:16:03 - ERROR PHP NOTICE in  Plugin 'weathermap': Undefined property: WeatherMapLink::$max_bandwidth_in_cfg in file: /var/www/cacti/plugins/weathermap/editor.php  on line: 1199
2017-02-05 01:16:03 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/weathermap/weathermap-cacti-plugin-editor.php: 21 require_once)(/plugins/weathermap/editor.php: 1199 CactiErrorHandler)(/lib/functions.php: 4238 cacti_debug_backtrace)
2017-02-05 01:16:03 - ERROR PHP NOTICE in  Plugin 'weathermap': Undefined property: WeatherMapLink::$max_bandwidth_out_cfg in file: /var/www/cacti/plugins/weathermap/editor.php  on line: 1199
2017-02-05 01:16:03 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/weathermap/weathermap-cacti-plugin-editor.php: 21 require_once)(/plugins/weathermap/editor.php: 1199 CactiErrorHandler)(/lib/functions.php: 4238 cacti_debug_backtrace)

It's all error have only in plugin what I download here. Later, I will update the version from Github and start testing again. Thank you.

@howardjones
Copy link
Owner

howardjones commented Feb 4, 2017

@pautiina I think you have an older version of editor.php. The current one in the database-refactor branch doesn't mention $max_bandwidth_in_cfg. This is a relatively recent change (about 2 months ago).

This is the version you should have: https://github.com/howardjones/network-weathermap/tree/database-refactor

You should probably grab editor.inc.php too, since that will also have changed.

[this is the kind of problem that pull requests solve, by the way]

@pautiina
Copy link
Contributor Author

pautiina commented Feb 5, 2017

@howardjones Maybe I have old version.
I delete my version and install plugin from your link.
When I open /cacti/plugins/weathermap/weathermap-cacti-plugin.php my Map not shown and I have error on Cacti.log:

2017-02-05 01:53:08 - ERROR PHP ERROR in  Plugin 'weathermap': Uncaught Error: Call to undefined function html_graph_start_box() in /var/www/cacti/plugins/weathermap/weathermap-cacti-plugin.php:399
Stack trace:
#0 /var/www/cacti/plugins/weathermap/weathermap-cacti-plugin.php(272): weathermap_fullview(false, false, 1)
#1 /var/www/cacti/plugins/weathermap/weathermap-cacti-plugin.php(153): weathermap_thumbview(1)
#2 {main}
  thrown in file: /var/www/cacti/plugins/weathermap/weathermap-cacti-plugin.php on line: 399
2017-02-05 01:53:08 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler)(/lib/functions.php: 4276 cacti_debug_backtrace)
2017-02-05 01:53:08 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'weathermap'

After this plugin disabled.
Also i have try change only editor.php on my version plugin I have error:

2017-02-05 02:02:48 - ERROR PHP WARNING in  Plugin 'weathermap': include(/var/www/html/cacti-0.8.8h/include/global.php): failed to open stream: No such file or directory in file: /var/www/cacti/plugins/weathermap/editor.php  on line: 14
2017-02-05 02:02:48 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/weathermap/weathermap-cacti-plugin-editor.php: 21 require_once)(/plugins/weathermap/editor.php: 14 include)(/plugins/weathermap/editor.php: 14 CactiErrorHandler)(/lib/functions.php: 4233 cacti_debug_backtrace)
2017-02-05 02:02:48 - ERROR PHP WARNING in  Plugin 'weathermap': include(): Failed opening '/var/www/html/cacti-0.8.8h/include/global.php' for inclusion (include_path='.:/usr/local/share/pear') in file: /var/www/cacti/plugins/weathermap/editor.php  on line: 14
2017-02-05 02:02:48 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/weathermap/weathermap-cacti-plugin-editor.php: 21 require_once)(/plugins/weathermap/editor.php: 14 include)(/plugins/weathermap/editor.php: 14 CactiErrorHandler)(/lib/functions.php: 4233 cacti_debug_backtrace)

I comment line 14 and error all away

@cigamit
Copy link

cigamit commented Feb 7, 2017

The function html_graph_start_box() is no longer in Cacti 1.0.x. Should use the html_start_box() and html_end_box().

@howardjones
Copy link
Owner

@cigamit what is this in response to? Where are you talking about?

I hardly added any of the Cacti 1.0 plugin yet...

@pautiina
Copy link
Contributor Author

pautiina commented Feb 7, 2017

@howardjones He talk about my error

@pautiina
Copy link
Contributor Author

pautiina commented Mar 14, 2017

Hello.
I look that now branch "origin/database-refactor" install and works on new version cacti.
Thanks, good work.

@howardjones
Copy link
Owner

Thank you for the update. I haven't had a chance to fully test!

@pautiina
Copy link
Contributor Author

I have some problem.
When I open Config editor - on browser openned weathermap-cacti10-plugin-editor.php, but this file not a pressent at the directory plugin.

@pautiina pautiina reopened this Mar 14, 2017
@howardjones
Copy link
Owner

As a first guess (I'm not by my PC) - copy weathermap-cacti-plugin-editor.php to weathermap-cacti10-plugin-editor.php

I started by separating out the 0.8.8 and 1.0 plugins completely - but that particular file for the editor is (probably) the same in both. I hope to reduce the amount of version-specific code, to make maintenance easier.

@pautiina
Copy link
Contributor Author

I try copy weathermap-cacti-plugin-editor.php to weathermap-cacti10-plugin-editor.php, but after this my account is logout when I try open editor.
Also I logout when try open Edit map from weathermap-cacti10-plugin-mgmt.php
I delete weathermap-cacti10-plugin-editor.php and change line 493 on file weathermap-cacti10-plugin.php to:
$pagefoot .= ' | <a target="_blank" href="weathermap-cacti-plugin-editor.php">' . __('Editor') . '</a>';
I not try edit file weathermap-cacti10-plugin-mgmt.php - but I think that this resolve problem with Editor.
Now I can use editor and it's works.
But when I click to Return to Cacti on editor, my browser try open file weathermap-cacti88-plugin-mgmt.php and httpd-error.log have error:
script '/var/www/cacti/plugins/weathermap-cacti88-plugin-mgmt.php' not found or unable to stat, referer: https://noc/cacti/plugins/weathermap/weathermap-cacti-plugin-editor.php?mapname=COND.conf&plug=

@pautiina pautiina reopened this Mar 14, 2017
@howardjones
Copy link
Owner

OK, so it will take a little more work than copying the file :-) I will try to take a look later. Sounds like it could just be as simple as making a variable for $CACTI_PLUGIN_NAME so that the return URL can be constructed correctly though.

In your last message - what do you mean by "try open editor" in the first sentence? I see the second one is by clicking on the map name in the plugin. Do you mean just by going to editor.php in your browser?

@pautiina
Copy link
Contributor Author

NO, I mean when I first try copy weathermap-cacti-plugin-editor.php to weathermap-cacti10-plugin-editor.php and click for link Editor on Weathermap View and Weathermap MGMT my browser open weathermap-cacti10-plugin-editor.php and I logout. I dont try open editor.php from browser.

@pautiina
Copy link
Contributor Author

I also have test Cycling all available maps in this group. on FullScrean
url on browser:
weathermap-cacti10-plugin.php?action=viewmapcycle&fullscreen=1&group=1
and my browser have error:

Uncaught ReferenceError: jQuery is not defined
    at idle-timer.min.js:2
(anonymous) @ idle-timer.min.js:2
map-cycle.js:5 Uncaught ReferenceError: jQuery is not defined
    at map-cycle.js:5
(anonymous) @ map-cycle.js:5
weathermap-cacti10-plugin.php?action=viewmapcycle&fullscreen=1&group=1:1432 Uncaught ReferenceError: $ is not defined
    at weathermap-cacti10-plugin.php?action=viewmapcycle&fullscreen=1&group=1:1432
(anonymous) @ weathermap-cacti10-plugin.php?action=viewmapcycle&fullscreen=1&group=1:1432
weathermap-cacti10-plugin.php?action=viewmapcycle&fullscreen=1&group=1:1450 Uncaught ReferenceError: $ is not defined
    at weathermap-cacti10-plugin.php?action=viewmapcycle&fullscreen=1&group=1:1450
(anonymous) @ weathermap-cacti10-plugin.php?action=viewmapcycle&fullscreen=1&group=1:1450
weathermap-cacti10-plugin.php?action=viewmapcycle&fullscreen=1&group=1:1460 Uncaught ReferenceError: $ is not defined
    at weathermap-cacti10-plugin.php?action=viewmapcycle&fullscreen=1&group=1:1460
(anonymous) @ weathermap-cacti10-plugin.php?action=viewmapcycle&fullscreen=1&group=1:1460

Maps not Cycling on FullScrean.
At not FullScrean Cycling my browser have this error:

Uncaught TypeError: that.reload is not a function
    at <anonymous>:148:22
(anonymous) @ VM9315:148

@pautiina
Copy link
Contributor Author

Hello. I have retest your change.
Now not have problem with editor link and problem with logout. It's work normally.
Only stayed problem with jQuery.

@Melantrix
Copy link

@howardjones right-click show source did the trick! this is on line 9:
var base_url = /;
i guess it should containt parenthesis? ('') is this a sort of bug or did I enter it somewhere in the wrong way?
note: in our configuration we don't have a /cacti folder in html, the server is directly hosted in the html folder. so NOT https://myserver/cacti/plugins/ but https://myserver/plugins/

@howardjones
Copy link
Owner

No, that's on me. The script should be formatting it correctly. Thanks for confirming.

@jpobeda
Copy link

jpobeda commented Apr 19, 2017

Also be aware that thold plugin has renamed a few columns on its tables for the version compatible with 1.x so I guess the old one hasn't been updated.

@cosu77
Copy link

cosu77 commented Apr 19, 2017

Hey, I have the same problem as @Melantrix. Tested on Chrome and Firefox the picker: https://grafice/plugins/weathermap/cacti-pick.php?action=link_step1 it's perfectly formatting. I can't pick up a data source. It's only text, no link. I run the tests on links. My line 9:
var base_url = /;
Thank you.

@YATV
Copy link
Contributor

YATV commented Apr 21, 2017

image

@YATV
Copy link
Contributor

YATV commented Apr 21, 2017

Missing files:
vendor/jquery/dist/jquery.min.js
vendor/jquery-fastlivefilter/jquery.fastLiveFilter.js

@howardjones
Copy link
Owner

howardjones commented Apr 21, 2017

@YATV - scroll up a few comments. They are supposed to be missing. I don't want to have other people libraries in the repo. You use 'bower install' to collect those up. This is done before a release is made, so the final zipped release does contain them, but a git clone shouldn't.

#58 (comment)

@howardjones
Copy link
Owner

@Melantrix @cosu77 - I think I have resolved this path problem now. Please confirm.

(And then I will close this issue, because it has become a giant mess of interweaved conversations! :-) We can create separate issues for specific problems - most of the remaining work for PDO/Cacti 1.0 already has separate tickets)

@pautiina
Copy link
Contributor Author

Hello.
I have try new instalation on new server and have error when enable plugin on cacti:

2017-04-21 22:08:05 - ERROR PHP ERROR in  Plugin 'weathermap': Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes in /var/www/data/cacti/plugins/weathermap/lib/cacti10-plugin-hooks.php:222
Stack trace:
#0 /var/www/data/cacti/plugins/weathermap/lib/cacti10-plugin-hooks.php(222): PDO->query('CREATE TABLE IF...')
#1 /var/www/data/cacti/plugins/weathermap/lib/cacti10-plugin-hooks.php(312): weathermap_setup_table()
#2 /var/www/data/cacti/lib/plugins.php(161): weathermap_show_tab(Array)
#3 /var/www/data/cacti/lib/plugins.php(68): api_plugin_run_plugin_hook('top_graph_heade...', 'weathermap', 'weathermap_show...', Array)
#4 /var/www/data/cacti/lib/html.php(1406): api_plugin_hook('top_graph_heade...')
#5 /var/www/data/cacti/include/top_header.php(91): html_show_tabs_left()
#6 /var/www/data/cacti/lib/functions.php(3308): include('/var/www/data/c...')
#7 /var/www/data/cacti/plugins.php(124): top_header()
#8 {main}
  thrown in file: /var/www/data/cacti/plugins/weathermap/lib/cacti10-plugin-hooks.php on line: 222

My database have utf8mb4_general_ci collection. After change collection to utf8_general_ci plugin have install and work.

@pautiina
Copy link
Contributor Author

Also I have find new bug when try choose 'Hover' Graph URL in editor I click to [Pick from Cacti] -open blank page
38

cacti.log have this error:

2017-04-21 22:50:38 - ERROR PHP ERROR in  Plugin 'weathermap': Uncaught Error: Call to undefined method EditorDataPicker::handleNodeStep1() in /var/www/data/cacti/plugins/weathermap/lib/WeatherMapUIBase.class.php:119
Stack trace:
#0 /var/www/data/cacti/plugins/weathermap/lib/cacti-pick.php(45): WeatherMapUIBase->dispatchRequest('node_step1', Array, NULL)
#1 /var/www/data/cacti/plugins/weathermap/cacti-pick.php(45): EditorDataPicker->main(Array)
#2 {main}
  thrown in file: /var/www/data/cacti/plugins/weathermap/lib/WeatherMapUIBase.class.php on line: 119
2017-04-21 22:50:38 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler)(/lib/functions.php: 4307 cacti_debug_backtrace)
2017-04-21 22:50:38 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'weathermap'

@howardjones
Copy link
Owner

The first one (utf8mb4) I have run into with Cacti itself recently... you didn't get any errors there?

The second one is already mentioned in this (too long) thread - not a new bug, just an outstanding task.

@pautiina
Copy link
Contributor Author

My fist Cacti by default have utf8_general_ci because it was an old version and I updated it to 1.x.x.
Then there were no mistakes.
On new server I use clean installation and by default Cacti database have utf8mb4_general_ci.
39

@howardjones
Copy link
Owner

Latest commit should resolve utf8mb4 issue (hopefully nothing regularly uses more than 190 chars!)

@g1augusto
Copy link

Hi,

I haven't found information on network-weathermap.com about downloading or testing the cacti 1.x plugin.

In case I'd be happy to contribute with some tests, just can you tell me where is the repository for it? is it a dedicated branch?

Thank you in advance,

@pautiina
Copy link
Contributor Author

pautiina commented Apr 23, 2017

Hello.
I simulated a new plugin installation with utf8mb4_general_ci database collaction and now plugin install normally and also have utf8mb4_general_ci:
40
But when I edit map permission on browser console have error and page with permission not have design:
41
Graph picker for nodes working normally but some values are not automatically substituted on editor:
42

@howardjones
Copy link
Owner

That's not a node. Did you check the box that says "Also fill in graph URL"?

@pautiina
Copy link
Contributor Author

pautiina commented Apr 23, 2017

That's not a node. Did you check the box that says "Also fill in graph URL"?

I'm sorry, I did not check the box. It's work.
Please add style for cursor when choose from list:)

@pautiina
Copy link
Contributor Author

pautiina commented Apr 23, 2017

Info url and 'Hover' Graph URL add but with mistake path:
43
In the beginning, /cacti/ is not added and the graph is not shown on the map.

@jpobeda
Copy link

jpobeda commented Apr 24, 2017

Odd, It doesn't work for me! I've just downloaded a copy of database-refactor and install it on cacti 1.1.3.
I see the list, but none of the graphs are clickables..the filter also does not work.

picker_host_links

What am I missing here ..

@cosu77
Copy link

cosu77 commented Apr 24, 2017

@jpobeda: you need to do the bower thing. please see this: 155965e
@howardjones: the picker it's not working. the path it's looks good now:
var base_url = '/';
my pointer looks like for text selector, not like link selector. if i can help with other infos please let me know.

thank you.

@howardjones
Copy link
Owner

@cosu77 OK, agreed about the cursor. But if you click on them, does it populate? I think you will probably get nearly the result you expect.

My problem list for the picker is currently:

  1. CSS to change cursor so links look clickable
  2. base_url is not used on the graph URLs
  3. There should be a cookie to remember the state of 'also populate graphs' checkbox
  4. The 'last few selected' history feature needs to be re-added

@cosu77
Copy link

cosu77 commented Apr 24, 2017

@howardjones yes, on Data Source. no, on Info URL & 'Hover' Graph URL

@howardjones
Copy link
Owner

I've just push a new commit for 1 and 2 on my list.
@cosu77 Did you check the box that says " Set both OVERLIBGRAPH and INFOURL (as well as TARGET)."?

image

@cosu77
Copy link

cosu77 commented Apr 24, 2017

That's embarrassing ... sorry. It's OK, i have Info URL & 'Hover' Graph URL on my maps. Thank you.

@Melantrix
Copy link

@howardjones Thanks for looking into this. I can't update the current plugin at this time because of time :D when i do and if i run into problems i will open a new issue, i agree with you it has been a too long thread already.

Thanks for the work so far!

@howardjones
Copy link
Owner

OK - so I'm going to close this issue. It has no real focus. The two outstanding picker problems are now #74 and #75. If you have a new issue - open a new issue!

@howardjones
Copy link
Owner

(and the utf8mb4 issue is now #76)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests