Example #1
0
def tiles():
    try:
        auth = get_jwt()
        return jsonify_data([
            {
                "title": "HoneyPot Dashboard",
                "description": "Patrick Vertical Histogram",
                "periods": [
                    "last_hour",
                    "last_7_days",
                    "last_30_days"
                ],
                "default_period": "last_7_days",
                "tags": [
                    "pat",
                    "ip_addresses"
                ],
                "type": "vertical_bar_chart",
                "short_description": "The number of bad IP addresses",
                "id": "vertical_histogram"
            },            
            {
                "description": "SecureX IP Blocking List",
                "tags": [
                    "pat"
                ],
                "type": "donut_graph",
                "short_description": "SecureX IP Blocking List",
                "title": "IP Feed Breakdown",
                "default_period": "last_7_days",
                "id": "donut"
            }             
        ])
    except:
        return jsonify_data([])
def tile_data():
    _ = get_jwt()
    req = get_json(DashboardTileDataSchema())
    print(green(req["tile_id"], bold=True))
    if req['tile_id'] == 'test-line-chart-graph':
        return jsonify_data(payload_for_line_chart)
    if req['tile_id'] == 'something_else':
        return jsonify_data(response2)
Example #3
0
def tiles():
    try:
        auth = get_jwt()
        return jsonify_data([{
            "id": "paris_temperature",
            "type": "metric_group",
            "title": "Real Paris Temperature",
            "periods": ["last_24_hours"],
            "short_description": "Paris Temperature",
            "description": "A longer description",
            "tags": ["test"],
        }])
    except:
        return jsonify_data([])
Example #4
0
def tile_data():
    _ = get_jwt()
    req = get_json(DashboardTileDataSchema())
    print (green(req,bold=True))
    print (green(req["tile_id"],bold=True))
    if req['tile_id'] == 'vertical_histogram':
        if req['period'] == 'last_7_days':
            data=gen_bar_chart_data(7)
        elif req['period'] == 'last_30_days':
            data=gen_bar_chart_data(30)            
        else:
            data=gen_bar_chart_data(1)
        donnees=gen_json_for_bar_chart(data,"vertical_histogram","timestamp")
        #print(cyan(donnees,bold=True))
        return jsonify_data(donnees)
    if req['tile_id'] == 'donut':      
        data=donut()
        info=gen_json_for_donut(data,"donut_tile")
        return jsonify_data(info)        
    elif req['tile_id'] == 'raas':
        return jsonify_data(response_six)    
Example #5
0
def tiles():
    try:
        auth = get_jwt()
        return jsonify_data([
            {
                "description": "A Markdown Tile",
                "periods": [
                    "last_hour"
                ],
                "tags": [
                    "test",
                    "test2"
                ],
                "type": "markdown",
                "short_description": "Shows some markdown stuff",
                "title": "Markdown ASA Interfaces Status",
                "id": "markdown_tile"
            }           
        ])
    except:
        return jsonify_data([])
def tiles():
    try:
        #auth = get_jwt()
        return jsonify_data([{
            "id":
            "test-line-chart-graph",
            "type":
            "line_chart",
            "title":
            "Test Graph",
            "periods": [
                "last_hour", "last_24_hours", "last_7_days", "last_30_days",
                "last_60_days", "last_90_days"
            ],
            "short_description":
            "A short description",
            "description":
            "A longer description",
            "tags": ["test"],
        }])
    except:
        return jsonify_data([])
Example #7
0
def tiles():
    try:
        auth = get_jwt()
        return jsonify_data([{
            "description":
            "DONUTS",
            "periods": [
                "last_24_hours", "last_7_days", "last_30_days", "last_60_days",
                "last_90_days"
            ],
            "tags": ["AWS"],
            "type":
            "donut_graph",
            "short_description":
            "DONUTS",
            "title":
            "Patrick DONUT",
            "default_period":
            "last_7_days",
            "id":
            "donut_tile"
        }])
    except:
        return jsonify_data([])
Example #8
0
def tiles():
    return jsonify_data([
        {
            "id": "test-summary",
            "type": "metric_group",
            "title": "Tuile a Patrick - Paris Temperature",
            "periods": ["last_24_hours"],
            "short_description": "Paris Temperature",
            "description": "A longer description",
            "tags": ["test"],
        },
        {
            "id": "test-graph",
            "type": "line_chart",
            "title": "Test Graph",
            "periods": ["last_24_hours"],
            "short_description": "A short description",
            "description": "A longer description",
            "tags": ["test"],
        },
    ])
Example #9
0
def tile_data():
    _ = get_jwt()
    req = get_json(DashboardTileDataSchema())
    print(green(req["tile_id"], bold=True))
    if req['tile_id'] == 'paris_temperature':
        date, hour, temp = paris_temperature()
        return jsonify_data({
            "observed_time": {
                "start_time": "2020-12-19T00:07:00.000Z",
                "end_time": "2021-01-18T00:07:00.000Z",
            },
            "valid_time": {
                "start_time": "2021-01-18T00:07:00.000Z",
                "end_time": "2021-01-18T00:12:00.000Z",
            },
            "data": [
                {
                    "icon": "brain",
                    "label": "Date",
                    "value": date,
                    "value-unit": "string",
                },
                {
                    "icon": "percent",
                    "label": "hour",
                    "value": hour,
                    "value-unit": "string",
                },
                {
                    "icon": "percent",
                    "label": "Temperature",
                    "value": temp,
                    "value-unit": "integer",
                },
            ],
            "cache_scope":
            "org",
        })
def tiles():
    # _ = get_jwt()
    return jsonify_data(
        [
            {
                "id": "test-summary",
                "type": "metric_group",
                "title": "Test Tile",
                "periods": ["last_24_hours"],
                "short_description": "A short description",
                "description": "A longer description",
                "tags": ["test"],
            },
            {
                "id": "test-graph",
                "type": "line_chart",
                "title": "Test Graph",
                "periods": ["last_24_hours"],
                "short_description": "A short description",
                "description": "A longer description",
                "tags": ["test"],
            },
        ]
    )
Example #11
0
def tile_data():
    _ = get_jwt()
    req = get_json(DashboardTileDataSchema())
    print(green(req["tile_id"], bold=True))
    if req['tile_id'] == 'donut_tile':
        return jsonify_data(response_two)
Example #12
0
def tile():
    _ = get_jwt()
    _ = get_json(DashboardTileSchema())
    return jsonify_data({})
Example #13
0
def update():
    update_database()
    return jsonify_data({})    
 def put(self, data=None, **params):
     data = utils.jsonify_data(data)
     response = requests.put(self.path, data=data, params=params, headers=self.headers)
     self.response = Response(self, response)
     self.response.raise_if_error()
     return self.response
Example #15
0
def tile_data():
    data = get_json(DashboardTileDataSchema())
    print(green(data["tile_id"], bold=True))
    if data["tile_id"] == "test-summary":
        date, hour, temp = paris_temperature()
        return jsonify_data({
            "observed_time": {
                "start_time": "2020-12-19T00:07:00.000Z",
                "end_time": "2021-01-18T00:07:00.000Z",
            },
            "valid_time": {
                "start_time": "2021-01-18T00:07:00.000Z",
                "end_time": "2021-01-18T00:12:00.000Z",
            },
            "data": [
                {
                    "icon": "brain",
                    "label": "Date",
                    "value": date,
                    "value-unit": "string",
                },
                {
                    "icon": "percent",
                    "label": "hour",
                    "value": hour,
                    "value-unit": "string",
                },
                {
                    "icon": "percent",
                    "label": "Temperature",
                    "value": temp,
                    "value-unit": "integer",
                },
            ],
            "cache_scope":
            "org",
        })
    else:
        return jsonify_data({
            "observed_time": {
                "start_time": "2020-12-28T04:33:00.000Z",
                "end_time": "2021-01-27T04:33:00.000Z",
            },
            "valid_time": {
                "start_time": "2021-01-27T04:33:00.000Z",
                "end_time": "2021-01-27T04:38:00.000Z",
            },
            "key_type":
            "timestamp",
            "data": [
                {
                    "key": 1611731572,
                    "value": 13
                },
                {
                    "key": 1611645172,
                    "value": 20
                },
                {
                    "key": 1611558772,
                    "value": 5
                },
                {
                    "key": 1611431572,
                    "value": 13
                },
                {
                    "key": 1611345172,
                    "value": 20
                },
                {
                    "key": 1611258772,
                    "value": 5
                },
                {
                    "key": 1611131572,
                    "value": 13
                },
                {
                    "key": 1611045172,
                    "value": 20
                },
                {
                    "key": 1610958772,
                    "value": 5
                },
                {
                    "key": 1610831572,
                    "value": 13
                },
                {
                    "key": 1610745172,
                    "value": 20
                },
                {
                    "key": 1610658772,
                    "value": 5
                },
                {
                    "key": 1610531572,
                    "value": 13
                },
                {
                    "key": 1610445172,
                    "value": 20
                },
                {
                    "key": 1610358772,
                    "value": 5
                },
            ],
            "cache_scope":
            "org",
        })