Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help creating dashboard template parsing metrics #185

Closed
bunghi opened this issue Oct 12, 2018 · 8 comments
Closed

Help creating dashboard template parsing metrics #185

bunghi opened this issue Oct 12, 2018 · 8 comments

Comments

@bunghi
Copy link

bunghi commented Oct 12, 2018

Hi,

I need some help creating a dashboard that allows me to parse some variables, like icinga2-default one.
This comes from another issue that I have trying to integrate interfacetable_v3t script to Icingaweb2 using InfluxDB and Grafana (Tontonitch/interfacetable_v3t#37 (comment))

I'm trying to adapt icinga2-default dashboard to my needs. I want to show all graphs for a hostname which metrics start with a string. Example:

check_brocade_interface,hostname=mqro01sansw03,metric=If_FC_port_0/0::check_interface_table_port::BpsIn,service=HW_Ports_Status
check_brocade_interface,hostname=mqro01sansw03,metric=If_FC_port_0/0::check_interface_table_port::BpsOut,service=HW_Ports_Status
check_brocade_interface,hostname=mqro01sansw03,metric=If_FC_port_0/0::check_interface_table_port::OperStatus,service=HW_Ports_Status
check_brocade_interface,hostname=mqro01sansw03,metric=If_FC_port_0/0::check_interface_table_port::PpsInDiscard,service=HW_Ports_Status
check_brocade_interface,hostname=mqro01sansw03,metric=If_FC_port_0/0::check_interface_table_port::PpsInErr,service=HW_Ports_Status
check_brocade_interface,hostname=mqro01sansw03,metric=If_FC_port_0/0::check_interface_table_port::PpsOutDiscard,service=HW_Ports_Status
check_brocade_interface,hostname=mqro01sansw03,metric=If_FC_port_0/0::check_interface_table_port::PpsOutErr,service=HW_Ports_Status

How can I build the URL to show me the 6 graphs? The only thing they have in common is the start of the metric name. In this case the query would be something like this:

SELECT mean("value") 
FROM "check_brocade_interface"
WHERE 
    ("hostname" = 'mqro01sansw03' AND "metric" like 'If_FC_port_0/0*') 

Translated to the Grafana URL would be something like this:

http://:3000/dashboard/db/icinga2-default?var-hostname=mqro01sansw03&var-metric=If_FC_port_0/0*

Can anyone help me? Thanks a lot!

@Mikesch-mp
Copy link
Owner

Hi Bunghi,

the query is like

select ..... where hostname = 'mqrosansw03' and metric =~ /^If_FC_port_0/0*/ 

Btw, its better to patch the script and remove the ::check_interface_table_port:: from the output. This was a tricky way to store them into the same rrd from PNP4Nagios, this is no longer needed for influxdb.

Send greetings to Mr. Schmid and Alexander ;)

Regards,
Carsten

@bunghi
Copy link
Author

bunghi commented Oct 12, 2018

Hi Carsten! Nice to see you around!!! Greetings already sent :)

I'm a bit lost when creating the variables in grafana dashboard. This is what I have but I don't know how to do it:
image

This is the query for metric variable:

SHOW TAG VALUES FROM check_brocade_interface WITH KEY = "metric" where hostname =~ /^$hostname$/ and metric=~ /^$metric$*/

The script generates this URL: http://grafanaserver:3000/http://mqde01influx01.marquardt.de:3000/dashboard/db/icinga2-brocade?var-hostname=mqro01sansw03&var-metric=If_FC_port_0/0

With this should show all 6 graphs but is not working.. please help!

Thanks again ;)

@bunghi
Copy link
Author

bunghi commented Oct 12, 2018

Hi again,

I checked that icinga2-default dashboard is using $perf variable. When building the url like this I see all interfaces graphs:

/icinga2-default?orgId=1&var-hostname=mqro01sansw03&var-service=HW_Ports_Status

But when I add the var-perf is showing one empty graph:
/icinga2-default?orgId=1&var-hostname=mqro01sansw03&var-service=HW_Ports_Status&var-perf=If_FC_Port_0%2F0

image

Curious thing is that when I go to the variable I can see the preview of values for $perf variable.

image

What am I missing here?

@Mikesch-mp
Copy link
Owner

You have to fill the regex field with (.*)::.*::.*
image

and add metric =~ /^$perf::*/ to your select, see my example
image

@bunghi
Copy link
Author

bunghi commented Oct 12, 2018

Great!!! Now it works but.. Can I see one graph per metric instead that all 6 metrics in one graph?

@bunghi
Copy link
Author

bunghi commented Oct 12, 2018

Hi Bunghi,

the query is like

select ..... where hostname = 'mqrosansw03' and metric =~ /^If_FC_port_0/0*/ 

Btw, its better to patch the script and remove the ::check_interface_table_port:: from the output. This was a tricky way to store them into the same rrd from PNP4Nagios, this is no longer needed for influxdb.

Send greetings to Mr. Schmid and Alexander ;)

Regards,
Carsten

Any easy way to remove ::check_interface_table_port:: ?

@bunghi
Copy link
Author

bunghi commented Oct 16, 2018

Hi.
I think you can close this issue since is solved now. I managed to create 2 separated graphs, one per BpsIn/BpsOut and one for the other 4 metrics.

For now I will leave the ::check_interface_table_port:: string in the metric name, not an issue ;)

Thanks again for your help @Mikesch-mp

@Mikesch-mp
Copy link
Owner

your welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants