0

I am trying to configure giraffe with graphite (0.9.10). Graphite is running successfully on port 8080 and I am able to run giraffe on port 9000. I have tried configuring dashboards.js in giraffe to point to a test metric within graphite (foo.bar.bz) but I do not see any chart in giraffe for that metric (only in graphite). I have most likely misconfigured dashboards.js - any suggestions on resolving/troubleshooting this would be greatly appreciated.

Update: The JSONP attempt is misconfigured - the error I see in the browser console is as follows (does not match with the current version of dashboards.js that I have on the server):

 http://localhost:9000/graphite/render?from=-10minutes&&target=foo.bar.bz&ma…&format=json&jsonp=jQuery1830533570789033547_1387578768576&_=1387578768732 

dashboards.js

var graphite_url = "0.0.0.0:8080"; 

var dashboards =
[
  { "name": "foo.bar.bz",  // give your dashboard a name (required!)
    "refresh": 5000,  // each dashboard has its own refresh interval (in ms)
    // add an (optional) dashboard description. description can be written in markdown / html.
    "description": "foo.bar.bz test" ,
    "metrics":  // metrics is an array of charts on the dashboard
    [
      {
        "alias": "foo.bar.bz",  // display name for this metric
        "target": "foo.bar.bz",  // enter your graphite barebone target expression here
        "description": "New test",  // enter your metric description here
        "summary": "sum",  // available options: [sum|min|max|avg|last|<function>]
        "summary_formatter": d3.format(",f") // customize your summary format function. see d3 formatting docs for more options
      },
      {
        "alias": "signup breakdown",
        "targets": ["sumSeries(enter.your.graphite.metrics.here)",  // targets array is also supported
                    "sumSeries(enter.another.graphite.metrics)"],   // see below for more advanced usage
        "description": "signup breakdown based on site location",
        "renderer": "area",  // use any rickshaw-supported renderer
        "unstack": true  // other parameters like unstack, interpolation, stroke, min, height are also available (see rickshaw documentation for more info)
      },
      {
        "alias": "Registration breakdown",
        "target": "sumSeries(enter.your.graphite.metrics.here)",
        // target can use a javascript function. This allows using dynamic parameters (e.g. period). See a few functions
        // at the bottom of this file.
        "target": function() { return 'summarize(events.registration.success,"' + entire_period() + 'min)' },
        "renderer": "bar",
        "description": "Registrations based on channel",
        "hover_formatter": d3.format("03.6g"),  // customize your hover format
        "null_as": 0  // null values are normally ignored, but you can convert null to a specific value (usually zero)
      },
    ]
  },
  { "name": "Visuals",
    "refresh": 10000,
    // you can use any rickshaw supported color scheme.
    // Enter palette name as string, or an array of colors
    // (see var scheme at the bottom).
    // Schemes can be configured globally (see below), per-dashboard, or per-metric
    "scheme": "classic9",   // this is a dashboard-specific color palette
    "description": "#Visual settings <img class='pull-right' src='img/giraffe.png' />",
    "metrics":
    [
      {
        "alias": "network",
        "target": "aliasByNode(derivative(servers.system.eth*),4)",
        "events": "*",  // instead of annotator, if you use the graphite events feature
                        // you can retrieve events matching specific tag(s) -- space separated
                        // or use * for all tags. Note you cannot use both annotator and events.
        "description": "main system cpu usage on production (cardinal interpolation, line renderer, colspan=3)",
        "interpolation": "linear",
        "colspan": 3,
      },
      {
        "alias": "cpu utilization",
        "target": "aliasByNode(derivative(servers.system.cpu.*),4)",  // target can use any graphite-supported wildcards
        "annotator": 'events.deployment',  // a simple annotator will track a graphite event and mark it as 'deployment'.
                                           // enter your graphite target as a string
        "description": "cpu utilization on production (using linear interpolation). Summary displays the average across all series",
        "interpolation": "linear",  // you can use different rickshaw interpolation values
        "stroke_width": 1,  // change stroke width
        "summary": "avg",
      },
      {
        "alias": "proc mem prod",
        "targets": ["aliasByNode(derivative(servers.system.cpu.user),4)",  // targets array can include strings,
                                                                           // functions or dictionaries
                   {target: 'alias(derivative(servers.system.cpu.system,"system utilization")',
                    alias: 'system utilization',                           // if you use a graphite alias, specify it here
                    color: '#f00'}],                                       // you can also specify a target color this way
                                                                           // (note that these values are ignored on the demo)
        // annotator can also be a dictionary of target and description.
        // However, only one annotator is supported per-metric.
        "annotator": {'target' : 'events.deployment',
                      'description' : 'deploy'},
        "description": "main process memory usage on production (different colour scheme and interpolation)",
        "interpolation": "step-before",
        "scheme": "munin",  // this is a metric-specific color palette
      },
      {
        "alias": "sys mem prod",
        "target": "aliasByNode(derivative(servers.system.cpu.*),4)",
        "events": "*",  // instead of annotator, if you use the graphite events feature
                        // you can retrieve events matching specific tag(s) -- space separated
                        // or use * for all tags. Note you cannot use both annotator and events.
        "description": "main system memory usage on production (cardinal interpolation, line renderer)",
        "interpolation": "cardinal",
        "renderer": "line",
        "max": 150,  // you can specify max value for the y-axis
        "min": 20,   // and also min
      },
    ]
  },
  { "name": "Setup",
    "refresh": 10000,
    "scheme": "colorwheel",
    "graphite_url": "demo",  // you can override the default graphite_url with a dashboard-specific url
    "description": "#Setup and configuration <img class='pull-right' src='img/giraffe.png' />"
                +"\n"
                +"\n##Installation"
                +"\n"
                +"\nTo install giraffe, simply [download](https://github.com/kenhub/giraffe/archive/master.zip) the code and run it from your browser."
                +"\nYou can put it on any type of web server, and also open the `index.html` file from your local drive."
                +"\n"
                +"\n##Authentication"
                +"\n"
                +"\nGiraffe uses JSONP to retrieve the data from your graphite server. It should work out of the box, unless you"
                +"\nhave setup authentication. Basic authentication seems to work in Firefox (it will prompt you), "
                +"\nbut with Chrome you might need to authenticate to your graphite server first, and then access Giraffe."
                +"\n"
                +"\n##Configuration"
                +"\n"
                +"\nThe main configuration for all dashboards is found in `dashboards.js`. The file is reasonably self-explanatory, "
                +"\nso please take a look."
                +"\n"
                +"\nIf you need to change the page layout, CSS, or add/remove a time period, you can also edit `index.html` and `css/main.css` file."
                +"\n"
                ,
    "metrics":
    [
      {
        "alias": "production HTTP req",
        "target": "aliasByNode(derivative(servers.gluteus-medius.Http.http_response_rates.*),4)",
        "renderer": "bar",
        "interpolation": "cardinal",
        "summary": "last",
      },
    ]
  },
];

var scheme = [
              '#423d4f',
              '#4a6860',
              '#848f39',
              '#a2b73c',
              '#ddcb53',
              '#c5a32f',
              '#7d5836',
              '#963b20',
              '#7c2626',
              ].reverse();

function relative_period() { return (typeof period == 'undefined') ? 1 : parseInt(period / 7) + 1; }
function entire_period() { return (typeof period == 'undefined') ? 1 : period; }
function at_least_a_day() { return entire_period() >= 1440 ? entire_period() : 1440; }

Update:

I was initially using giraffe-web and using nginx to proxy requests to the node service. Since I have stopped using giraffe-web temporarily, I have commented out the proxy part from the nginx default file (relevant section copied below). I am running this as a separate server on port 86 - if that is the issue, I can change my nginx conf file. As of now, the giraffe webUI is not able to retrieve the test metric that I am trying to retrieve from graphite (I can view that metric chart in graphite). I have changed dashboards.js to the IP address on which the service is running. I can try changing the hostname of the server if nothing else works. Thanks.

server { ## giraffe front end for graphite listen 86; listen [::]:86; ## ipv6only=on; server_name giraffe; root /opt/graphite/webapp/giraffe-master/; index index.html index.htm; ##logging per server access_log /var/log/nginx/giraffe/access.log; error_log /var/log/nginx/giraffe/error.log;

    location / {
            #proxy_redirect off;
            #proxy_set_header X-Real-IP $remote_addr;
            #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            #proxy_set_header X-Forwarded-Proto $scheme;
            #proxy_set_header Host $http_host;
            #proxy_set_header X-Nginx-Proxy true;
            #proxy_set_header Connection "";
            #proxy_http_version 1.1;
            #proxy_set_header Host $host;  ##removed the $http_host option
            #proxy_pass http://giraffe;
    }

}

ali haider
  • 19,175
  • 17
  • 80
  • 149

2 Answers2

2

I'm the creator of Giraffe. Hope I can help.

The first thing I noticed is that you configured graphite_url to point to 0.0.0.0:8080. This must be incorrect. Since Giraffe is javascript-based, it runs on the client, so the address should be the external IP / FQDN of your graphite server instead.

Furthermore, if you want to run Giraffe on the same server as your graphite, the easiest way to do so is to place the giraffe files under the same folder structure as graphite, and make sure your webserver points to it.

For example, on our setup I have placed the giraffe files in /opt/graphite/webapp/giraffe and then in our nginx config set up the document root as root /opt/graphite/webapp (if you're using Apache, you can do the same using DocumentRoot I believe).

Then you should be able to access both graphite and giraffe on the same address / port, and this would remove any cross-domain issues for you as well. You then don't need to run it on different ports.

Cheers Yoav

gingerlime
  • 5,206
  • 4
  • 37
  • 66
  • thank you for responding. I tried changing the url yesterday before your comment but for some reason, the new URL was not being picked up even after I restarted/reloaded nginx (I most likely missed something). I will try again - and with the giraffe directory inside the /opt/graphite/webapps directory. I will update once I make progress or get stuck. Once again, thanks for responding. – ali haider Dec 21 '13 at 13:57
  • I'm not entirely sure why but the dashboards.js file still mentions localhost:8080 even though I hardcoded the ip address in the file. I am using giraffe-web (node) to launch giraffe. – ali haider Dec 21 '13 at 22:29
  • I tried the nginx route without the giraffe-web node service. The JSONP calls are still invalid (URL is now in the form ip address:port number on which nginx is listening/ip address and port number for graphite/...) which are obviously failing. – ali haider Dec 21 '13 at 23:37
  • I'm not very familiar with giraffe-web, but I suggest you ask on the github issue tracker for giraffe-web for assistance. – gingerlime Dec 22 '13 at 15:13
  • I think I will do that - as per my last comment, I could not get it to work without giraffe-web as well. Thanks – ali haider Dec 22 '13 at 19:37
  • Can you upload (to pastebin, or something similar) your nginx config, folder structure of graphite/giraffe and giraffe's dashboards.js file?Also - try upgrading graphite to 0.9.x branch. There were some jsonp-related changes in graphite in recent versions. – gingerlime Dec 23 '13 at 16:56
  • you might also want to try assigning a FQDN to your ip address via DNS or hardcoded into `/etc/hosts` on your local PC – gingerlime Dec 23 '13 at 16:57
  • thanks - I updated my question (please check last Update in the question). – ali haider Dec 23 '13 at 18:30
  • sorry, but it's very hard to read your configs this way, I suggest pasting each file into [pastebin](http://pastebin.com/) and adding a link, or using a [gist](http://gist.github.com). Currently it's not very clear. I'd like to see all the files that I mentioned to be able to help. I would also recommend upgrading graphite as I mentioned above. – gingerlime Dec 23 '13 at 19:32
  • thanks for responding - I will do so in the next 1-2 hours. I am using graphite 0.9.10 (but not using ceres for now). – ali haider Dec 23 '13 at 20:20
1

I use apache2 webserver, I added an alias for my giraffe in /etc/apache2/httpd.conf.

Alias /giraffe/   /home/vagrant/giraffe/

Restart your apache webserver, it will be available as:

IP/giraffe/index.html.

http://graphite_url.com/giraffe/index.html

replace graphite url with your IP address or your FQDN

Secondly, Are you sure if your carbon Daemon is running?

Reg URL,

var graphite_url = "http://10.0.1.11"; 
Vamsi Krishna
  • 475
  • 3
  • 9
  • 22
  • thanks for sharing - yes carbon and graphite are running - i can see the graphite charts but not the giraffe one (perhaps I misunderstood some aspect of the configuration). Right now, I am using nginx and can access giraffe - just the chart URL is misconfigured and the JSONP call fails. – ali haider Dec 23 '13 at 13:21
  • Can you capture your traffic using tcpdump and share what urls you see. Be sure to query the right element. var cpu = "a.b.c.cpu"; and populate it in your dashboard. – Vamsi Krishna Dec 23 '13 at 19:07
  • I checked in chrome tools - the JSONP call was malformed for some reason (e.g. x.x.x.x:86/x.x.x.x/....). The IP address was duplicated. I will post more relevant information soon - I have been making changes to the setup today. – ali haider Dec 23 '13 at 20:21