ripienaar / gdash

A dashboard for Graphite
http://www.devco.net/
Apache License 2.0
754 stars 117 forks source link

Not able to search on dashboards #114

Open code-decode opened 11 years ago

code-decode commented 11 years ago

First, Thank you for such nice dashboard tool.

I am not able to search on the dashboards using the field on upper right. I looked up the logs but do not see any error. I have tried the name of dashboard and description.

This must be a user issue. I tried my best to look through the closed issues but could not anything that I am missing.

bitflingr commented 11 years ago

what does your :templatedir: look like in config/gdash.yaml ?

code-decode commented 11 years ago

xx@vishnud3:/opt/gdash$ cat config/gdash.yaml :graphite: http://vishnud4.qa.xx.com :templatedir: /opt/gdash/graph_templates

.....

root@vishnud3:/opt/gdash# pwd /opt/gdash root@vishnud3:/opt/gdash# tree graph_templates/ graph_templates/ ├── dashboards │   ├── admin_qa1web101 │   │   ├── admin.graph │   │   ├── dash.yaml │   │   ├── jdbcConnectionPool_Connections.graph │   │   ├── jdbcConnectionPool_threadPool.graph │   │   ├── Memory_Heap.graph │   │   ├── Memory_NonHeap.graph │   │   ├── os_OpenFileDescriptors.graph │   │   ├── os_SystemLoadAverage.graph │   │   ├── sessions_Active.graph │   │   ├── sessions_create_expire.graph │   │   └── threads_template.graph │   └── admin_qa4web101 │   ├── admin.graph │   ├── dash.yaml │   ├── jdbcConnectionPool_Connections.graph │   ├── jdbcConnectionPool_threadPool.graph │   ├── Memory_Heap.graph │   ├── Memory_NonHeap.graph │   ├── os_OpenFileDescriptors.graph │   ├── os_SystemLoadAverage.graph │   ├── sessions_Active.graph │   ├── sessions_create_expire.graph │   └── threads_template.graph └── node_templates └── collectd ├── cpu-average.graph ├── cpu-max.graph ├── dash.yaml ├── disk-IO.graph ├── disk-usage.graph ├── entropy.graph ├── fork_rate.graph ├── load.graph ├── memory-usage.graph ├── network.eth0.errors.graph ├── network.eth0.trafic.graph ├── network.eth1.errors.graph ├── network.eth1.trafic.graph ├── processes.graph ├── uptime.graph └── users.graph

7 directories, 60 files

bitflingr commented 11 years ago

ill see if i can reproduce this with a similar layout as yours. When you view source on the home page and search for 'data-source=' do you see an array of your graphs?

something like

<input class="search-query" style="height: 25px;" name="dashboard" type="text" placeholder=" Dashboard..." data-provide="typeahead" data-items="10" data-source='["machines/server01", "machines/server02",  "machines/server03".....etc.
code-decode commented 11 years ago

I do not see the array.

<form id="form-search" name="dashboards" style="margin: 0;" class="form-search" method="get" action="/search">
                      <div class="input-append">
                      <input class="span2 search-query" name="dashboard" type="text" placeholder="Dashboard..." data-provide="typeahead" data-items="10" data-source='node_templates/node exampledashboards/Platform-admin on qa1web101dashboards/Platform-admin on qa2web101dashboards/Platform-admin on qa3web101dashboards/Platform-admin on qa4web101' autocomplete="off" />
bitflingr commented 11 years ago

Hmm so it's missing the '[]' and ','. I am guessing it has something to do with the whitespace. I probably won't be able to reproduce this till later this week.

bitflingr commented 11 years ago

I have not gotten around to this but noticed that the node_template is the default files. could you try deleting or moving them out of the graph_templates directory?

code-decode commented 11 years ago

I removed the files from node_templates directory but that did not change the search results.

I do not know ruby. In sinatra_app.rb the search elements are created by appending category and name. Do I need to provide some parameter in my graph/dashboard configuration for these to be set.

Thank you for your help. Much appreciated..

bitflingr commented 11 years ago

I was about to give up because i was not able to reproduce but i just discovered that it is a Ruby version issue. Ruby 1.9 and above outputs Array.to_s method differently than 1.8.7. Examples below:

1.8.7

~$ irb1.8
irb(main):001:0> arr = []
=> []
irb(main):002:0> arr << 'a'
=> ["a"]
irb(main):003:0> arr << 'b'
=> ["a", "b"]
irb(main):004:0> arr << 'c'
=> ["a", "b", "c"]
irb(main):005:0> arr
=> ["a", "b", "c"]
irb(main):006:0> arr.to_s
=> "abc"

1.9.3

1.9.3p448 :001 > arr = []
 => []
1.9.3p448 :002 > arr << 'a'
 => ["a"]
1.9.3p448 :003 > arr << 'b'
 => ["a", "b"]
1.9.3p448 :004 > arr << 'c'
 => ["a", "b", "c"]
1.9.3p448 :005 > arr
 => ["a", "b", "c"]
1.9.3p448 :006 > arr.to_s
 => "[\"a\", \"b\", \"c\"]"

Ill come up with a fix shortly but you can try using ruby 1.9.3 or 2.0.0 to verify.

bitflingr commented 11 years ago

I believe calling .inspect rather than .to_s on an array object will do the trick but ill leave it up to the maintainers wether or not they want to add this in or just not support ruby 1.8.7 since I believe it is now deprecated.

code-decode commented 11 years ago

I moved to ruby 1.9.3 as suggested and this is resolved. Thank you!