Grafana not reading results properly - parsing

My problem is the following
I have this text
ID:
Origem: 4
Mensagem: Parametro invalido: CHASSI_INVALIDO: chassi
Gateway: 2
Versao: v20170130
Layout: BASERNS2
Data: 2017-04-10 10:00:04.592
And grafana (doesnt matter the panel) reads like this
ID: Origem: 4 Mensagem: Parametro invalido: CHASSI_INVALIDO: chassi
Gateway: 2 Versao: v20170130 Layout: BASERNS2 Data: 2017-04-10
10:00:04.592
How can I get for Grafana to show the result properly, with the 'new line'?
Is that even possible?
Thanks

Related

How to use multiple data sources in Eleventy

I would like to be able to call more than one json file in an eleventy template page (gallery.njk).
I've tried putting everything into a nested json file 'collections.json' but its not working and i'd rather have it separated out anyway for manageability purposes.
I'm trying something like this, but it's not working:
---
pagination:
data: "collection1", "collection2"
size: 1
alias: image
permalink: "/gallery/{{ image.title | slug }}/"
---
Have also tried:
data: collection1, collection2
data: [ collection1, collection2 ]
This is what does work, but it only gives me 1 collection obviously:
---
pagination:
data: collection1
size: 1
alias: image
permalink: "/gallery/{{ image.title | slug }}/"
---

Simplest and Optimised way to read and edit YAMLs

I've some YAML files which I wanted to apply to create Custom Resources. But before applying it I want to change the spec and ENVs of the YAML snippet. So what could be the best way to do this?
What I'm doing now is:
Let suppose this is the YAML
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
namespace: default
spec:
appinfo:
appns: 'default'
applabel: 'app=nginx'
appkind: 'deployment'
# It can be true/false
annotationCheck: 'false'
# It can be active/stop
engineState: 'active'
chaosServiceAccount: pod-delete-sa
monitoring: false
# It can be delete/retain
jobCleanUpPolicy: 'delete'
experiments:
- name: pod-delete
spec:
components:
env:
# set chaos duration (in sec) as desired
- name: TOTAL_CHAOS_DURATION
value: '30'
# set chaos interval (in sec) as desired
- name: CHAOS_INTERVAL
value: '10'
# pod failures without '--force' & default terminationGracePeriodSeconds
- name: FORCE
value: 'false'
I Download this file from the raw link. (1 function for this)
Replace a field like jobCleanUpPolicy: 'delete' to jobCleanUpPolicy: 'retain' (1 fn)
Replace the next line when a match is found like value: 'false' to value: 'true' for FORCE ENV. (1 fn)
Applying the final manifest created! (1 function)
Can this be optimized?
If you create a struct representing the resource (or, even better, can import the package which defines the CRD) you could take the yaml string, marshal it into the struct and then edit the fields directly as fields of a struct instead
Hi You may use LitmusPortal to use this.Refer

Need guidance to use .map,.group,.pluck, etc. to make multi series line chart in ruby on rails app

I'm trying to display a multi series line chart using chartkick in a Ruby on Rails app.
The chart should display paper_types and the weightfor each type during some time period.
SCREENSHOT ADDED
This is my latest try:
<%= line_chart [
{name: #pappi.map{|p| [p.paper_type]}, data: #pappi.map{|t| [t.date, t.paper_weight] }, 'interpolateNulls':true}
] %>
Where #pappi = Paper.all
The code above outputs as the picture below, where every paper_type rounds up on one single line, instead of showing separate lines for each paper_type.
What I'm looking for is a chart similar to the screenshot below, were each paper_type has it's own line.
Can someone please help me with this so I can get the outcome I want?
I did not test this, only read the doc and concluded the following:
line_chart expects you to give argument structured like this: (from the Javascript documentation)
line_chart [
{ name: 'Line1', data: { '2017-01-01' => 2, '2017-01-08' => 3 } },
{ name: 'Line2', data: { '2017-01-01' => 1, '2017-01-08' => 7 } },
]
# try it in your view to make sure it works as described below
This will create a chart with 2 lines (Line1 and Line2), horizontal axis will contain 2 values 2017-01-01 and 2017-01-08 and the vertical axis will be a scale, probably from 1 to 7 (min from data to max from data).
Following this data structure in your context:
Specs (correct me if I am wrong):
one line for each different paper_type
weight value for a given paper_type and a given date
Object mapping to match the desired data structure:
# controller
all_paper_type_values = Paper.all.pluck(:paper_type).uniq
#data_for_chart = all_paper_type_values.map do |paper_type|
{ name: paper_type, data: Paper.where(paper_type: paper_type).group_by_month(:created_at).sum(:weight) }
end
# view
<%= line_chart(#data_for_chart) %>
This is no scoped to any user / dates (period). You will have to include this in the code above.
Try this and let me know if it fails.
What happens when you put any of these options in the rails console? Do you get multiple series of data?
Have you tried?
<%= line_chart [ name: paper.paper_type, data: current_user.papers.group(:paper_type).group_by_week(:created_at).count ] %>

Image from URL attached to image_tag won't display in ruby on rails

I'm pulling back data from an object with intentions to display an image in a view. I'm debugging the object to my browser and this is what I see:
image: !ruby/object:Parse::File
parse_filename: xxxxxxxx-xxxxxxxxx-xxxxxxxxxx-image.jpg
url: http://files.parse.com/xxxxxxxx-xxxxxxxxx-xxxxxxxxxx-image.jpg
In my view I've tried the following:
<%= image_tag object["url"] %>
<%= image_tag object["parse_filename"] %>
However the image is never shown.
Googled but can't find much information on how to this any other way. As far as I know this should but it doesn't.
Would appreciate some help
Thanks for your time
Update full debug result:
--- !ruby/hash:Parse::Object
alternativeColour: false
collection: 1
colour: 2
favourite: false
gender: 2
image: !ruby/object:Parse::File
parse_filename: sds232-eee7-4203-840b-jk233k23232-image3.jpg
url: http://files.parse.com/sdsd232-7f16-sd23-sds2-a4c7884d118e/dcefd915-eee7-4203-840b-jk233k23232-image3.jpg
price: 23.42
productType: 2
recommended: false
size: 6
title: Bomber Jacket
createdAt: '2014-04-03T20:33:41.020Z'
updatedAt: '2014-06-18T19:03:24.220Z'
objectId: yZksdhNJPm
I had to access using object["image"].url. I was wondering why url and file_pathname was slightly indented under image. Now I realise why.
image["image"].url
It seems that you're not using the proper object or attribute.
First, try to print the image using the URL like this:
<%= image_tag "http://files.parse.com/xxxxxxxx-xxxxxxxxx-xxxxxxxxxx-image.jpg" %>
Once that's working, try getting the correct object and attribute. Next line should give you all object details
<%= debug object %>
If it prints nothing, check your controller variables and how you're using them on the view
UPDATE:
According to the full object debug message, the property should be accessed as object["image"].url
Cheers

Concatenate lists for a given key in mustache template

Here's what my data looks like (YAML):
-
name: objectA
components:
-
name: "component_1"
-
name: "component_2"
styles:
-
name: "new style"
components:
-
name: "component_1"
-
name: "other style"
components:
-
name: "component_4"
I would like to retrieve in my mustache the full list of components for objectA, meaning i need to access all the components children values and concatenate them or uniq them.
The goal would be to have a template like this:
{{#allComponents}}
{{name}}
{{/allComponents}}
which should output:
component_1
component_2
component_4
PS: i am using GRMustache
There's very little chance any Mustache implementation could handle such a specific need with any native built-in syntax of any kind. And GRMustache does actually not.
The simplest path is to prepare your allComponents key before rendering your data.

Resources