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

Update method to have getdash show up on grafana main page #54

Closed
lawre opened this issue May 11, 2016 · 6 comments
Closed

Update method to have getdash show up on grafana main page #54

lawre opened this issue May 11, 2016 · 6 comments
Assignees
Labels

Comments

@lawre
Copy link

lawre commented May 11, 2016

Previously there were instructions to modify grafana 2.x's app.js files:

sed -i 's|\({text:\"Dashboards\",icon:\"fa fa-fw fa-th-large\",href:a.getUrl(\"/\")}\)|\1,{text:\"GetDash\",icon:\"fa fa-fw fa-th-large\",href:a.getUrl(\"/dashboard/script/getdash.js\")}|' /usr/share/grafana/public/app/app.*js

This no longer works. Please provide a new method for integrating getdash with the main grafana 3.x page. Thanks!

@anryko
Copy link
Owner

anryko commented May 12, 2016

Hi lawre,
Now it is more complicated to change grafana 3 menu. However, I found IMO better solution with adding redirect dashboard. Unfortunately I can't just give you the dashboard JSON to import because grafana will automatically execute it and perform the redirect. So there will be no way for you to save imported dashboard. Nevertheless I'll do my best trying to explain how to do that manually, using grafana GUI.

You will have to create a new grafana dashboard. In dashboard settings you should rename it to "Scripted Dashboard". Then add a "text" row of "html" type. Then to the text field of that row you need paste this code:

<meta http-equiv="refresh" content="1;url=/dashboard/script/getdash.js">
<script type="text/javascript">window.location.href = "/dashboard/script/getdash.js"</script>

After this is done you will have to save the dashboard. That's it. Now from your Grafana Home screen you can select newly created "Scripted Dashboard" and it will automatically redirect you to the actual GetDash dashboard.

Here is exported dashboard. Just in case I failed in my explanation and maybe JSON code will be clearer :). You will not be able to import it but maybe it will help.

{
  "id": 2,
  "title": "Scripted Dashboard",
  "tags": [],
  "style": "dark",
  "timezone": "browser",
  "editable": true,
  "hideControls": true,
  "sharedCrosshair": false,
  "rows": [
    {
      "collapse": false,
      "editable": true,
      "height": "250px",
      "panels": [
        {
          "title": "Scripted Dashboard automatic redirect",
          "error": false,
          "span": 12,
          "editable": true,
          "type": "text",
          "isNew": true,
          "id": 1,
          "mode": "html",
          "content": "<meta http-equiv=\"refresh\" content=\"1;url=/dashboard/script/getdash.js\">\n<script type=\"text/javascript\">window.location.href = \"/dashboard/script/getdash.js\"</script>",
          "links": [],
          "height": "20px",
          "transparent": true
        }
      ],
      "title": "Row"
    }
  ],
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "templating": {
    "list": []
  },
  "annotations": {
    "list": []
  },
  "schemaVersion": 12,
  "version": 0,
  "links": []
}

@lawre
Copy link
Author

lawre commented May 12, 2016

I tested your method and it works better than the method before. I had no idea an html refresh/redirect would work, so I hope this is an intended feature and the grafana team won't "fix" it in the future. :)

@lawre lawre closed this as completed May 12, 2016
@anryko
Copy link
Owner

anryko commented May 12, 2016

I hope so too :).

@lawre
Copy link
Author

lawre commented May 14, 2016

one issue i found: once the redirect is created, it is impossible to edit it through the UI since it gets redirected away. Any suggestions?

@anryko
Copy link
Owner

anryko commented May 14, 2016

Create a new one with the same name. Then on saving action it will let you overwrite the old one.

@vasekch
Copy link

vasekch commented Oct 12, 2017

Another downside is that you can't use such dashboards in playlists, such a pity. Nice workaround, though.

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

3 participants