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

(vodka? graphsrv?) javascript error "Uncaught TypeError: this.data[0] is undefined" #140

Closed
mozai opened this issue Oct 7, 2021 · 10 comments
Assignees
Labels

Comments

@mozai
Copy link

mozai commented Oct 7, 2021

vaping, version 1.4.3, fping: Version 5.0

Steps to reproduce:

  • fping already installed
  • pip install -U vaping
  • mkdir -p ~/.vaping
  • wget -q -O ~/.vaping/config.yml https://raw.githubusercontent.com/20c/vaping/master/examples/standalone_dns/config.yml
  • edit ~/.vapinig/config.yaml to change
    • plugins entry "std_fping add a new key for period: 500, as the default 20ms is way too short for remote targets
    • probes[0].groups to
- name: LAN
  hosts: 
  - {host: "192.168.1.1", name: gateway, color: red}
- name: Remote
  hosts: 
  - {host: "8.8.8.8", name: Equius, color: blue}  
  - {host: "140.82.112.4", name: Kanaya, color: green}

Expected to see:

  • graphs updating. (Would be nice to set the refresh time. default interval for fping plugin is 1m but seems like graphsrv (flask?) is refreshing much more often than that)

What I saw instead:

     Uncaught TypeError: this.data[0] is undefined
        render_data http://localhost:7021/static/graphsrv/js/graphsrv.smokestack.js:20
        render_dynamic http://localhost:7021/static/graphsrv/js/graphsrv.js:1356
        update http://localhost:7021/static/graphsrv/js/graphsrv.js:983
        _update http://localhost:7021/static/graphsrv/js/graphsrv.js:1107
      ...
  • graphs get a red error message on them frequently that says "Data Feed Stopped"
@vegu
Copy link
Contributor

vegu commented Oct 11, 2021

@mozai Thanks for the feedback.

I haven't had a chance to do a hands on follow up on this, however I think after adjusting the fping period you would also need to adjust the plugin interval to give it enough time for (count*period), count defaults to 10, so with a period of 500ms, interval should be at least 5s, but id even go a bit higher than that.

@vegu vegu added the bug label Nov 12, 2021
@vegu
Copy link
Contributor

vegu commented Nov 12, 2021

@mozai did you have a chance to try out the proposed changes to the config.

Keeping ticket open regardless and marking as a bug, since i want to reproduce on our end - also this should config validation instead of breaking the chart.

Would be nice to set the refresh time. default interval for fping plugin is 1m but seems like graphsrv (flask?)

Agree, opened separate issue at #146

@vegu vegu added this to the Next release milestone Nov 12, 2021
@mozai
Copy link
Author

mozai commented Nov 12, 2021

"did you try the change?"
I changed plugins[0].interval to 5s and restarted vaping. Still getting "this.data[0] is undefined" on each refresh.
I changed it to 10s, then vaping stop; vaping start and I'm still getting "this.data[0] is undefined" on each refresh.

... github won't let me attach the config file as an attachment for ease of use. I'll have to paste it as a comment.

@mozai
Copy link
Author

mozai commented Nov 12, 2021

{logging: {formatters: {simple: {format: '%(asctime)s - %(name)s - %(levelname)s: %(message)s'}}, handlers: {console: {class: logging.StreamHandler, formatter: simple, level: DEBUG, stream: 'ext://sys.stdout'}}, loggers: {vaping: {handlers: [console], level: DEBUG}, vodka: {handlers: [console], level: DEBUG}}, version: 1}, plugins: [{count: 10, interval: 10s, name: std_fping, output: [vodka], period: 500, type: fping}, {apps: {graphsrv: {enabled: true, graphs: {multitarget: {format_y: ms, id_field: host, plot_y: avg, type: multitarget}, smokestack: {id_field: host, plot_y: avg, type: smokestack}}}}, data: [{handlers: [{index: host, type: index}, {container: list, limit: 500, type: store}], type: fping}], name: vodka, plugins: [{async: thread, bind: '0.0.0.0:7021', debug: true, name: http, routes: {/: graphsrv->overview_view, /graph: graphsrv->graph_view, /graph_data: {methods: [GET, POST], target: graphsrv->graph_data}, /overview_read_file: graphsrv->overview_read_file, /targets: graphsrv->targets}, server: self, static_url_path: /static, type: flask}], type: vodka}], probes: [{groups: [{hosts: [{color: red, host: 192.168.1.1, name: gateway}], name: LAN}, {hosts: [{color: blue, host: 8.8.8.8, name: Google}, {color: green, host: 140.82.112.4, name: Github}], name: Remote}], name: latency, output: [vodka], type: std_fping}]}

@vegu vegu self-assigned this Feb 21, 2022
@vegu
Copy link
Contributor

vegu commented Feb 21, 2022

@mozai not having any luck reproducing what you are seeing, does that error actually go away / change to something else if you don't set the period to 500?

Looking at the config you posted in the last comment i dont see anything out of the ordinary, but a properly formatted yaml or json file would be welcome.

I've played around with some extreme period values now and none of them are breaking the charts for me, so i think the issue lies somewhere else. Moving this out of next release for now, but leaving ticket open.

Thanks

@vegu vegu removed this from the Next release milestone Feb 21, 2022
@mozai
Copy link
Author

mozai commented Jun 4, 2022

I know it's been a while. Trying again with version 1.5

$ fping --version
fping: Version 5.1
$ python --version
Python 3.10.4
$ pip install -U vaping
Downloading vaping-1.5.0-py3-none-any.whl
Requirement already satisfied: munge (1.2.1.1)
Downloading pid-3.0.4-py2.py3-none-any.whl
Downloading confu-1.8.0-py3-none-any.whl
Downloading pluginmgr-1.1.0-py3-none-any.whl
Requirement already satisfied: python-daemon (2.3.0)
Requirement already satisfied: click (8.1.3)
Downloading tomlkit-0.7.2-py2.py3-none-any.whl
Downloading PyYAML-5.4.1.tar.gz
Requirement already satisfied: setuptools (59.7.0)
Requirement already satisfied: lockfile (0.12.2)
Requirement already satisfied: docutils (0.16)
Requirement already satisfied: chardet (4.0.0)
Requirement already satisfied: idna (3.3)
Requirement already satisfied: urllib3 (1.26.9)

$ pip install -U vodka graphsrv
Using cached vodka-3.2.0-py3-none-any.whl (34 kB)
Using cached graphsrv-2.1.0-py2.py3-none-any.whl (256 kB)

$ mkdir -p ~/.vaping
$ wget -q -O ~/.vaping/config.yml https://raw.githubusercontent.com/20c/vaping/master/examples/standalone_dns/config.yml
$ vaping start --debug

Not seeing the "Uncaught TypeError" but seeing this instead:

  • http://127.0.0.1:7021/view/detail/latency.public_dns/ all four graphs do not have lines
  • Three smaller graphs each have "max undefinedms 10/10" in their titles.
  • javascript console reports "13:03:05.309 Unexpected value NaN parsing y attribute. 243 d3.v5.min.js:2:105972"

This is before I changed the std_fping plugin with adding period: 500. My notes from above mention something about a 20ms default timeout which still seems way too short; I can see it in the debug log as:

2022-06-04 13:05:15,188 - vaping.plugins.fping - DEBUG: popen fping -u -C10 -p20 -e 8.8.8.8 4.2.2.1 208.67.222.222
vaping.plugins.fping popen fping -u -C10 -p20 -e 8.8.8.8 4.2.2.1 208.67.222.222 __init__.py:128

Updating the example config file now and trying again with period 500ms

$ sed -i '/name: std_fping/{s/$/\n    period: 500/;}' ~/.vaping/config.yml
$ vaping start --debug

Reloaded, now there's lines and bar-graphs, and I see a new warning in the browser's JS console:

Now trying with the target list from the start of the bug report (see attached file)

and I'm seeing the errors again:

13:40:27.762 Uncaught TypeError: this.data[0] is undefined
render_data http://127.0.0.1:7021/static/graphsrv/js/graphsrv.smokestack.js:20
render_dynamic http://127.0.0.1:7021/static/graphsrv/js/graphsrv.js:1356
update http://127.0.0.1:7021/static/graphsrv/js/graphsrv.js:983
_update http://127.0.0.1:7021/static/graphsrv/js/graphsrv.js:1107
Graph http://127.0.0.1:7021/static/graphsrv/js/graphsrv.js:1117
jQuery 7
success http://127.0.0.1:7021/static/graphsrv/js/graphsrv.js:785
jQuery 6
request http://127.0.0.1:7021/static/graphsrv/js/graphsrv.js:740
require http://127.0.0.1:7021/static/graphsrv/js/graphsrv.js:802
Graph http://127.0.0.1:7021/static/graphsrv/js/graphsrv.js:1085
multitarget http://127.0.0.1:7021/static/graphsrv/js/graphsrv.multitarget.js:7
instantiate http://127.0.0.1:7021/static/graphsrv/js/graphsrv.js:1562
http://127.0.0.1:7021/graph?targets=all&id=multitarget-1&fit=yes&type=multitarget&config=multitarget&source=latency.Remote:36
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:709
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:719
onload http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:773
load http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:774
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:715
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:719
onload http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:773
load http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:774
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:715
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:719
onload http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:773
load http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:774
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:715
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:719
onload http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:773
load http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:774
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:715
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:719
onload http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:773
load http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:774
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:715
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:719
onload http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:773
load http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:774
load_next http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:715
require http://127.0.0.1:7021/static/graphsrv/js/twentyc.core.js:683
http://127.0.0.1:7021/graph?targets=all&id=multitarget-1&fit=yes&type=multitarget&config=multitarget&source=latency.Remote:25
onload http://127.0.0.1:7021/graph?targets=all&id=multitarget-1&fit=yes&type=multitarget&config=multitarget&source=latency.Remote:11
EventHandlerNonNull* http://127.0.0.1:7021/graph?targets=all&id=multitarget-1&fit=yes&type=multitarget&config=multitarget&source=latency.Remote:7
http://127.0.0.1:7021/graph?targets=all&id=multitarget-1&fit=yes&type=multitarget&config=multitarget&source=latency.Remote:20
graphsrv.smokestack.js:20:28

Also seeing a warning in stderr, don't know if it's related:
2022-06-04 13:42:35,724 - vaping.plugins.fping - WARNING: probe time exceeded interval
vaping.plugins.fping probe time exceeded interval init.py:294

@mozai
Copy link
Author

mozai commented Jun 4, 2022

config.yml.txt

@mozai
Copy link
Author

mozai commented Jun 4, 2022

Wait, is this because the example config file has three targets, but I'm only using two? There's still three small graphs at the bottom of the page?

Huh. When probes[].groups.hosts[] has only one or two, I get the errors. When I have three no errors. When I have four, no errors, though the big graph shows all four and the little graphs only show the first three.

@vegu
Copy link
Contributor

vegu commented Jun 6, 2022

Wait, is this because the example config file has three targets, but I'm only using two? There's still three small graphs at the bottom of the page?

@mozai i think you may be right, but haven't had a chance to confirm yet, will try to take a look at this this week Thanks

@vegu
Copy link
Contributor

vegu commented Jun 16, 2022

Issue fixed in graphsrv 2.1.1

to update:

pip install graphsrv -U

@vegu vegu closed this as completed Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants