-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fab767a
commit a537615
Showing
34 changed files
with
15,286 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- 'master' | ||
workflow_dispatch: | ||
inputs: | ||
BRANCH: | ||
required: true | ||
default: 'master' | ||
DEPLOY: | ||
required: true | ||
default: 'false' | ||
type: choice | ||
options: | ||
- 'true' | ||
- 'false' | ||
ENV: | ||
required: true | ||
default: 'testing' | ||
type: choice | ||
options: | ||
- testing | ||
- staging | ||
- production | ||
|
||
env: | ||
BRANCH: ${{ github.head_ref || github.ref_name || github.event.inputs.BRANCH }} | ||
DEPLOY: ${{ github.event.inputs.DEPLOY || 'false' }} | ||
ENV: ${{ github.event.inputs.ENV || 'testing' }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ env.BRANCH }} | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/[email protected] | ||
with: | ||
node-version: "14.x" | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- name: Cache yarn cache | ||
uses: actions/cache@v2 | ||
id: cache-yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Cache node_modules | ||
id: cache-node-modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.node-version }}-nodemodules- | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build and test frontend | ||
run: yarn build | ||
|
||
- name: Setup build environment | ||
id: build_environment | ||
run: echo "::set-output name=BUILD_VERSION::$(jq -r .version package.json)" | ||
|
||
- name: Package plugin | ||
run: | | ||
mv dist netdata-datasource | ||
zip "netdata-datasource-${{ steps.build_environment.outputs.BUILD_VERSION }}.zip" netdata-datasource -r | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: netdata-datasource-${{ steps.build_environment.outputs.BUILD_VERSION }}.zip | ||
path: ./netdata-datasource-${{ steps.build_environment.outputs.BUILD_VERSION }}.zip | ||
|
||
outputs: | ||
artifact_name: netdata-datasource-${{ steps.build_environment.outputs.BUILD_VERSION }}.zip | ||
|
||
internal-deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup deploy environment | ||
id: deploy_environment | ||
run: | | ||
case $GITHUB_EVENT_NAME in | ||
workflow_dispatch) | ||
echo "::set-output name=ENV::${{ env.ENV }}" | ||
echo "::set-output name=DEPLOY::${{ env.DEPLOY }}" | ||
;; | ||
pull_request) | ||
echo "::set-output name=ENV::staging" | ||
echo "::set-output name=DEPLOY::false" | ||
;; | ||
push) | ||
echo "::set-output name=ENV::staging" | ||
echo "::set-output name=DEPLOY::true" | ||
;; | ||
*) | ||
echo "::set-output name=ENV::staging" | ||
echo "::set-output name=DEPLOY::false" | ||
;; | ||
esac | ||
- name: Update Netdata Infra | ||
if: ${{ steps.deploy_environment.outputs.DEPLOY == 'true' }} | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }} | ||
repo: ${{ secrets.NETDATA_INFRA_REPO }} | ||
workflow: Netdata Grafana Plugin Deploy | ||
ref: master | ||
inputs: '{"artifact_name": "${{ needs.build.outputs.artifact_name }}", "env": "${{ steps.deploy_environment.outputs.ENV }}", "workflow_run_id": "${{ github.run_id }}"}' | ||
continue-on-error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/[email protected] | ||
with: | ||
node-version: "14.x" | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- name: Cache yarn cache | ||
uses: actions/cache@v2 | ||
id: cache-yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Cache node_modules | ||
id: cache-node-modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.node-version }}-nodemodules- | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile; | ||
if: | | ||
steps.cache-yarn-cache.outputs.cache-hit != 'true' || | ||
steps.cache-node-modules.outputs.cache-hit != 'true' | ||
- name: Build and test frontend | ||
run: yarn build | ||
|
||
- name: Get plugin metadata | ||
id: metadata | ||
run: | | ||
sudo apt-get install jq | ||
export GRAFANA_PLUGIN_ID=$(cat dist/plugin.json | jq -r .id) | ||
export GRAFANA_PLUGIN_VERSION=$(cat dist/plugin.json | jq -r .info.version) | ||
export GRAFANA_PLUGIN_TYPE=$(cat dist/plugin.json | jq -r .type) | ||
export GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip | ||
export GRAFANA_PLUGIN_ARTIFACT_CHECKSUM=${GRAFANA_PLUGIN_ARTIFACT}.md5 | ||
echo "::set-output name=plugin-id::${GRAFANA_PLUGIN_ID}" | ||
echo "::set-output name=plugin-version::${GRAFANA_PLUGIN_VERSION}" | ||
echo "::set-output name=plugin-type::${GRAFANA_PLUGIN_TYPE}" | ||
echo "::set-output name=archive::${GRAFANA_PLUGIN_ARTIFACT}" | ||
echo "::set-output name=archive-checksum::${GRAFANA_PLUGIN_ARTIFACT_CHECKSUM}" | ||
echo ::set-output name=github-tag::${GITHUB_REF#refs/*/} | ||
- name: Read changelog | ||
id: changelog | ||
run: | | ||
awk '/^## / {s++} s == 1 {print}' CHANGELOG.md > release_notes.md | ||
echo "::set-output name=path::release_notes.md" | ||
- name: Check package version | ||
run: if [ "v${{ steps.metadata.outputs.plugin-version }}" != "${{ steps.metadata.outputs.github-tag }}" ]; then printf "\033[0;31mPlugin version doesn't match tag name\033[0m\n"; exit 1; fi | ||
|
||
- name: Package plugin | ||
id: package-plugin | ||
run: | | ||
mv dist "${{ steps.metadata.outputs.plugin-id }}" | ||
zip "${{ steps.metadata.outputs.archive }}" "${{ steps.metadata.outputs.plugin-id }}" -r | ||
md5sum "${{ steps.metadata.outputs.archive }}" > "${{ steps.metadata.outputs.archive-checksum }}" | ||
echo "::set-output name=checksum::$(cat \"./${{ steps.metadata.outputs.archive-checksum }}\" | cut -d' ' -f1)" | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ steps.metadata.outputs.archive }} | ||
path: ./${{ steps.metadata.outputs.archive }} | ||
|
||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body_path: ${{ steps.changelog.outputs.path }} | ||
|
||
- name: Add plugin to release | ||
id: upload-plugin-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./${{ steps.metadata.outputs.archive }} | ||
asset_name: ${{ steps.metadata.outputs.archive }} | ||
asset_content_type: application/zip | ||
|
||
- name: Add checksum to release | ||
id: upload-checksum-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./${{ steps.metadata.outputs.archive-checksum }} | ||
asset_name: ${{ steps.metadata.outputs.archive-checksum }} | ||
asset_content_type: text/plain | ||
|
||
outputs: | ||
artifact_name: ${{ steps.metadata.outputs.archive }} | ||
|
||
internal-deploy: | ||
needs: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update Netdata Infra | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }} | ||
repo: ${{ secrets.NETDATA_INFRA_REPO }} | ||
workflow: Netdata Grafana Plugin Deploy | ||
ref: master | ||
inputs: '{"artifact_name": "${{ needs.release.outputs.artifact_name }}", "env": "production", "workflow_run_id": "${{ github.run_id }}"}' | ||
continue-on-error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
node_modules/ | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
dist/ | ||
artifacts/ | ||
work/ | ||
ci/ | ||
e2e-results/ | ||
|
||
# Editor | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
...require("./node_modules/@grafana/toolkit/src/config/prettier.plugin.config.json"), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
## 1.0.0 (Unreleased) | ||
|
||
Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,51 @@ | ||
# netdata-grafana-datasource-plugin | ||
Netdata Grafana Datasource Plugin | ||
# Netdata data source for Grafana | ||
|
||
[](https://github.com/grafana/grafana-starter-datasource/actions?query=workflow%3A%22CI%22) | ||
|
||
_Enhanced high-fidelity troubleshooting data source for the Open Source community!_ | ||
|
||
 | ||
|
||
## What is Netdata data source plugin for Grafana? | ||
|
||
We are huge fans of Open Source culture and it is rooted deeply into our DNA, so we thought that the Open Source community would hugely benefit from Netdata providing a Grafana data source plugin that would expose its powerful data collection engine. | ||
|
||
With this data source plugin we expose the troubleshooting capabilities of Netdata in Grafana, making them available more widely. Some of the key capabilities: | ||
- Real-time monitoring with single-second granularity. | ||
- Installation and out-of-the-box integrations available in seconds from one line of code. | ||
- 2,000+ metrics from across your whole Infrastructure, with insightful metadata associated with them. | ||
- Access to our fresh ML metrics (anomaly rates) - exposing our ML capabilities at the edge! | ||
|
||
|
||
## Getting started | ||
|
||
### 1. Connect your Nodes to Netdata Cloud | ||
|
||
Netdata’s data source plugin connects directly to our Netdata Cloud API’s, meaning that you’ll need to have your nodes (hosts) connected to [Netdata Cloud](https://app.netdata.cloud/?utm_source=grafana&utm_content=data_source_plugin) in order to be able to have them exposed on our plugin. For security purposes you will also need an API token for authentication (which you can get from within your Netdata profile). | ||
|
||
Note: If you don't have an account [sign-up](https://app.netdata.cloud/?utm_source=grafana&utm_content=data_source_plugin) for free to get one! | ||
|
||
> Netdata Agent will need to be installed and running on your server, VM and/or cluster, so that it can start collecting all the relevant metrics you have from the server | ||
and applications running on it. More info at https://learn.netdata.cloud/docs/get-started. | ||
|
||
### 2. Ensure you have an API Token for authentication purposes. | ||
|
||
Once you have all your nodes connected to Netdata Hub you must proceed with creating an API token, which will be linked to your Netdata Cloud account. The API token provides a means to authenticate external calls to our APIs, allowing the same access as you to the Spaces and Rooms you can see on Netdata Hub. | ||
|
||
 | ||
|
||
### 3. Install Netdata data source plugin on Grafana Cloud or locally | ||
|
||
For detailed instructions on how to install the plugin on Grafana Cloud or locally, please checkout the Plugin installation docs. | ||
|
||
### 4. Add your API token to the Netdata data source plugin configuration | ||
|
||
Once you have added your API token to Netdata data source plugin you’re ready to start taking advantage of Netdata’s troubleshooting capabilities in Grafana by starting creating your charts and dashboards! | ||
|
||
 | ||
|
||
## Learn more | ||
|
||
- What is Netdata? - https://learn.netdata.cloud/docs/overview/what-is-netdata | ||
- Netdata Cloud - https://learn.netdata.cloud/docs/cloud | ||
- Netdata Agent - https://learn.netdata.cloud/docs/get-started |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// This file is needed because it is used by vscode and other tools that | ||
// call `jest` directly. However, unless you are doing anything special | ||
// do not edit this file | ||
|
||
const standard = require('@grafana/toolkit/src/config/jest.plugin.config'); | ||
|
||
// This process will use the same config that `yarn test` is using | ||
module.exports = standard.jestConfig(); |
Oops, something went wrong.