Skip to content

Instantly share code, notes, and snippets.

View sauravvishal8797's full-sized avatar

Saurav Vishal sauravvishal8797

  • Airbase
  • Bangalore, Karnataka, India
View GitHub Profile

GSoC'18 Report - Enhancement to FOSSASIA's Phimpme Android Application

About Me:

Will start with injecting the metrics data into the Hawkular server (adding of new metrics could be another good idea here which could increase the user-friendliness of the project with users). This can be done easily with the use of Curl command with the metrics REST api provided by the project. For instance I can use cpu load metrics data of an operating system(to send to the server). I could use the stats for smaller intervals of time and store it in a json file(cpu_load.json)
Will send the data to the hawkular server using the post
Curl command.
Now I will check the data by setting up Grafana and its Hawkular plugin to actually build a dashboard and look at the cpu_json(cpu load metrics) for that period of time. It would look something like the one shown below.
Will be adding alerting to be notified for particular conditions(here it will notify when the CPU load exceeds the provided alerting condition) which will trigger the alert/event when the conditions are met. Wil
11:59:33, 281 INFO [org.hawkular.alerts.action.api] (Thread-251 (ActiveMQ-client-
global-threads-1118700939)) HAWKALERT240001: Plugin [email] has received an
action message: [BusActionMessage[action=Action[eventId='cpu-load-trigger-
1472551176767-dc41aaf3-bdd7-4a89-a950-44dc92f10c8b',
ctime=1472551176768, event=Alert [alertId=temperature-trigger-1472551176767-dc41aaf3-bdd7-4a89-a950-44dc92f10c8b, status=OPEN, ackTime=0, ackBy=null, resolvedTime=0, resolvedBy=null, context={}], result='null']]]
PipeManager.config("alerts", RestfulPipeConfiguration.class)
.withUrl(new URL("http://livingontheedge.hawkular.org/"))
.forClass(Developer.class);
LoaderPipe<Developer> pipe = PipeManager.get("alerts", activityInstance);
pipe.reset();
pipe.read(new ReadDevelopersActivityCallback());
public static class ReadDevelopersActivityCallback
extends AbstractActivityCallback<List<Developer>> {
@sauravvishal8797
sauravvishal8797 / cpu_load_test.json
Created April 1, 2017 18:31
data for testing the alert trigger
[
{"timestamp": 1468620000000, "value": 0},
{"timestamp": 1468621800000, "value": 0.072},
{"timestamp": 1468623600000, "value": 0.04},
{"timestamp": 1468625400000, "value": 0},
{"timestamp": 1468627200000, "value": 0.2},
{"timestamp": 1468629000000, "value": 0.106},
{"timestamp": 1468630800000, "value": 0.04},
{"timestamp": 1468632600000, "value": 0.034},
{"timestamp": 1468634400000, "value": 0.06},
@sauravvishal8797
sauravvishal8797 / trigger_cond.json
Created April 1, 2017 18:24
Alerting metadata including severity, actionPlugin etc.
{
"triggers": [
{
"trigger": {
"id": "cpu-load trigger",
"name": "Trigger for excessive cpu-load",
"severity": "HIGH",
"enabled": true,
"actions": [
{
@sauravvishal8797
sauravvishal8797 / cpu_load.json
Created April 1, 2017 18:16
Cpu-load stats for smaller intervals of time.
[
{"timestamp": 1468533600000, "value": 0},
{"timestamp": 1468535400000, "value": 0.72},
{"timestamp": 1468537200000, "value": 0.126},
{"timestamp": 1468539000000, "value": 0},
{"timestamp": 1468540800000, "value": 0.120},
{"timestamp": 1468542600000, "value": 0.132},
{"timestamp": 1468544400000, "value": 0},
{"timestamp": 1468546200000, "value": 0.096},
{"timestamp": 1468548000000, "value": 0.102},