Tuesday, August 21, 2018

Grafana Buttons and Actions

Viewing data with Grafana is quite simple but taking some action not so much. So here is my way of doing it :)

A simple solution is to use a TEXT Panel and inject some HTML with a button and a Javascript code.

Bellow is a sample that will use the $Datasource and perform a GET request on a specific URL "/"

<button class="btn navbar-button gf-timepicker-nav-btn" style="width: 100%" onClick="runGame()">Start</button>

<script>
function runGame() {
  var t = angular.element('grafana-app').injector().get('templateSrv');
  t.updateTemplateData();
  url = t.index.Datasource.datasourceSrv.datasources["$Datasource"].url;
  
  $.get( url + "/" , function( data ) {
    $( "#output" ).html( data );
  });
  
}

</script>

<p id="output"></p>

From this point things should be much easier.

Sunday, March 11, 2018

Template Build and Deployment for Bamboo plugin - new release / breaking changes !!!

Version 3.6.121 bring a few fixes but also a breaking change - please read carefully:

Feature improvements:

- Artifact templating introduces a new concept - the artifacts per job, when copying the template artifacts job keys are being concatenated to artifact names. This has been done to prevent duplicate artifacts in jobs templated in multiple stages. In order to use the new functionality you must enable it under "System templates" administration page. Attention !!! This functionality will break initially artifact downloader tasks, you will need to select again the artifact names !
- The build template report will now list artifact definition aswell making it easier to review the plans
- A new cache has been introduced too maintain a list of templates in the system (some customers with very large number of jobs had trouble opening Misc page of jobs)

Fixes:

- Bulk template setting is not enabling all templating features