Can't Change Metric Alias in Grafana Using a Zabbix Plugin - grafana

I want to show multiple CPU Usage from different hosts in one graph but they all end up with the same name and I can't tell which line represents which host:
here's the snapshot.
I'm using Grafana 5.2.4 with a Zabbix plugin 3.9.1. My Zabbix version is 3.0.12.
I've tried overriding legends in Grafana but there's no such option. Also, Zabbix plugin doesn't allow connecting directly to DB, so I can't use the ALIAS BY option either. I've tried using macros in Zabbix to include host name in item name, but {HOST.NAME} just ends up as is in the item name (and not replaced by the actual values).
Any solutions will be hugely appreciated.

You should use the templating feature of the Zabbix Grafana plugin,see the attached screens and the following description for a working example.
I have a Routers Zabbix Hostgroup, so I define a Router Grafana variable to match the hosts (Routers.*), see the first screenshot.
Enable both multi-value and Select All
Then in the metrics configuration use a single metric configured this way:
Group: Routers
Host: $Router (mind the $, the variable will be expanded in real time accordingly to the selection)
Item: the common item name (i.e.: ICMP Response Time)
And you will get something similar to the second screenshot, with a host picker on top and multiple selections.

So There's a "Functions" button below each metric when we are configuring and editing our graph. There's an "Alias" option and when you hover over it you see more options. If you click on "setAlias", you can define an alias for each metric.
Since this solution requires setting each alias individually, I recommend the solution that was suggested by Simone Zabberoni above. but this one is also worth knowing since it might come in handy at times.

Related

Grafana templating merge variables

I'm looking for a solution to merge two templating variables in grafana(data source: prometheus).
My use case is:
I've my first variable:
deployment = label_values(kube_deployment_labels{namespace="$namespace"},deployment)
and the second one:
statefulset = label_values(kube_statefulset_labels{namespace="$namespace"},statefulset)
What I'm looking for is a only one dropdown menu(selector) because in my dashboard I wan't to be able to select a deployment or a statefulset but not both at the same time.
I've tried at the different side:
1) With prometheus by using a query like this:
kube_deployment_labels{namespace="$namespace"} or kube_statefulset_labels{namespace="$namespace"}
But in this case I'm not able to extract the labels(could be "deployment" or statefulset")
2) It seems not possible to perform a merge of two template variables in grafana like this:
$deployment,$statefulset
Maybe I've missed something...
Thanks,
Matt
I do it by creating two separate variable and give them same label name.
Since the label name is same it will only show one drop-down.
https://grafana.com/docs/grafana/latest/variables/templates-and-variables/#basic-variable-options

Grafana templates for Prometheus

I am trying to update the node-exporter-full Grafana dashboard with some of our internal labels as templates. We have labels for "pod" and "servertype" which can be used to get a subset of "nodes" to list at the top of the dashboard.
I can add "pod" like:
label_values(pod)
Then I can reference "pod" in the node query as follows:
label_values(node_boot_time{job="clients",pod="$pod"}, instance)
This works. If I want to add servertype in the middle how would I pull a list of "servertype" based on "pod" which is selected?
I already know the "node" can be filtered with:
label_values(node_boot_time{job="clients",pod="$pod"},servertype="$servertype", instance)
Answer was pretty simple once I reread the documentation. Using "up" function currently and it is working fine but there may be a better solution.
node_boot_time has been changed to node_boot_time_seconds
Refer to this link to get all the name changes since prometheus 0.16.0
https://github.com/prometheus/node_exporter/issues/830

Can I enable / Disable an Azure Service Bus Topic using Powershell

I have spent a couple of hours search for a solution to disable my Azure Service Bus Topics using Powershell.
The background for this is we want to force a manual failover to our other region.
Obviously I could click in the Portal:
but I want to have a script to do this.
Here is my current attempt:
Any help would be great.
Assuming you're sure your $topic contains the full description, modify the status parameter in the array and then splat it back using the UpdateTopic method. I'm afraid I can't test this at present.
$topic.Status = "Disabled"
$topicdesc = $NamespaceManager.UpdateTopic($topic)
I don't think you'll need to set the entity type for the Status, nor do you require semi-colons after each line of code in your loop.
References
PowerShell Service Bus creation sample script (which this appears to be based off): https://blogs.msdn.microsoft.com/paolos/2014/12/02/how-to-create-service-bus-queues-topics-and-subscriptions-using-a-powershell-script/
UpdateTopic method: https://msdn.microsoft.com/en-us/library/azure/microsoft.servicebus.namespacemanager.updatetopic.aspx
Additional note: please don't screenshot the code - paste it in. I'd rather copy-and-paste than type things out.

How to list Zabbix macro values for a host

I've a Zabbix item which I can't get to work using a Zabbix macro.
The item key I start with looks like this:
web.page.regexp[10.0.0.100,/path,"(.*)",, \1]
And testing it with the following command also shows me nice results:
$ sudo zabbix_agentd -t 'web.page.regexp[10.0.0.100,/path,80,"(.*)",, \1]' --print
web.page.regexp[10.0.0.100,/path,80,"(.*)",, \1] [s|works]
But of course using the IP hardcoded isn't nice, that's why I want to use the predefined macros within the key, like this:
web.page.regexp[{HOST.IP1},/path,"(.*)",, \1]
But unfortunately this macro doesn't resolve to anything and the result looks like this:
web.page.regexp[10.0.0.100,/path,80,"(.*)",, \1] [s|]
Therefore I'd love to know if there's any way to list all the macro values for a specific host in Zabbix. Or is there a better way to use the {HOST.*} macros?
Using localhostis not an option for me - I want to test the public interface and I want to understand why the macros don't work as I expect it.
Cheers
Macro {HOST.IP1} should be expanded correctly for passive agent items (although it is suggested to just use {HOST.IP}). However, if your item is an active agent item, then {HOST.IP1} will expand to *UNKNOWN*, because an item is not attached to an interface in that case.
As for macro list for a host, it was implemented for user macros under ZBXNEXT-210 and is already available in pre-2.5.0 trunk (which is not ready for production yet).

Can I replace Host Names on Fiddler results?

Fiddler's host field is not always clear, especially with IP direct calls, or service calls I don't recognize.
I would like a way to replace certain names or name regex, with other more clearly defined names.
for instance, "193-149-72-221.drip.trouter.io" actually means Skype traffic, though the IP changes. so I would prefer to use: "*.drip.trouter.io".
Or, if there is a tag field or something like that that I can apply to hosts, and show the column in the list. I'm pretty flexible, but I'd really like to be able to classify or rename hosts to something I can recognize easier at a glance.
(I have looked around for this on google and checked similar questions on here with no luck)
Thanks.
Click Rules > Customize Rules.
public static BindUIColumn("MyFunkyName", 60)
function FillNameColumn(oS: Session): String {
if (oS.hostname.EndsWith("trouter.io") return "SkypeStuff";
if (oS.hostname.EndsWith("bunnies.com") return "CuteStuff";
return oS.hostname;
}
Save the file. You now have a column titled MyFunkyName which shows a string based on the hostname of the target.