Prometheus: Viewing __meta_* and __address__ labels - monitoring

As this blog post suggests, __meta_* labels are provided by service discovery mechanism in Prometheus and they are available for relabelling purposes. As the documentation suggests, such labels get removed later in the lifecycle and are not exposed in the web UI.
Is there any way to view them prior to disposal for debugging purposes?

You can find them on the service discovery status page, e.g. http://demo.robustperception.io:9090/service-discovery

Related

Ingress Controller in AKS (Application Gateway) / Define custom names for http settings and rules

I have deployed an application gateway with ingress controller for my AKS Cluster.
Once I deploy the ingress resource the underlaying resources are then visible in the Azure portal like listner, http settings,rule, etc.
My "problem" is that I would like to have more controll over the respective names of the rules and http settings.
The names that Azure is using for the respective http settings and rule names, are a bit unclear when there are multiple such http settings, rules and listners. The names that azure used are for example like this:
Listener: fl-e1903c8aga3446b783607aec6d6ecba8a
Rule: rr-u1903c8aa8446b8b32078ec6d6ecba8a
Having it like this, makes it extreemly difficult to keep track which is which.
I have looked in the doku [1] and [2] but I wasnt able to find an option where I could set this up in the ingress resource.
Do you have any idea where can I set this up, if at all?
Thank you,
Mike
[1] https://azure.github.io/application-gateway-kubernetes-ingress/
[2] https://learn.microsoft.com/en-us/azure/application-gateway/ingress-controller-expose-service-over-http-https

How to find/define JMX key for ActiveMQ Artemis monitoring

I'm trying to setup monitoring of ActiveMQ Artemis with Zabbix. My intention is to monitor the availability of Artemis and also monitor the size and number of messages accumulating in queues, and setup alerts.
I enabled JMX on Artemis as the documents in struct, and I built the JMX example. From what I can tell, this only involves adding the following lines to these two files in the broker:
management.xml
<connector connector-port="1099" connector-host="192.168.56.101" />
Opened the port:
sudo ufw allow 1099
broker.xml
<jmx-management-enabled>true</jmx-management-enabled>
So I think JMX is enabled, although I haven't managed to confirm this.
In Zabbix I added the "host" (a system to monitor), but the next step is creating an "item" (a thing on the system). To do this I need a JMX key, something similar to jmx["java.lang:type=Memory","HeapMemoryUsage.used"]. (I tried this one but I don't get any data back) This defines the MBean to call.
So where can I find the keys for the available things to monitor on Artemis? Or have I screwed something up here and am not looking for the right thing?
In the example there is a JMWExample.java program. It connects to Artemis, publishes a message, uses JMX to count the messages, then removes the message -- but I don't see any keys to MBeans.
Also, in the admin console for Artemis there is a JMX tab, which lists what I think is all the available things to monitor. For example, I have a queue called "test.queue". Under the JMX tab I find:
org.apache.activemq.artemis:broker="0.0.0.0",component=addresses,address="test.topic",subcomponent=queues,routing-type="multicast",queue="test.queue"
And there are numerous methods listed, including countMessages(). Have I answered my own question here? Is this what I'm looking for?
If so, how does it fit into this key format, jmx[object_name,attribute_name]
{EDIT}
I'm looking at the JMX tab on the console. If I understand correctly, the key should have a format like this: jmx[object_name,attribute_name]
So I see the the object name under the JMX tab for one of my test queues is: org.apache.activemq.artemis:broker="0.0.0.0",component=addresses,address="test.topic",subcomponent=queues,routing-type="multicast",queue="test.queue"
And it has an attribute of: MessageCount
So I treid this, which doesn't work. I also tried replacing 0.0.0.0 with the IP address.
jmx[org.apache.activemq.artemis:broker="0.0.0.0",component=addresses,address="test.topic",subcomponent=queues,routing-type="multicast",queue="test.queue",MessageCount]
The default value for <jmx-management-enabled> is true so you don't need to explicitly configure that.
You can confirm that JMX is enabled by connecting to the broker using a tool like JConsole or JVisualVM which ship with the JVM. Ideally you would do this locally to avoid any network configuration issues.
The broker exposes lots of different MBeans for managing all parts of the broker. Here are the different "control" objects with their default MBean object naming pattern:
ActiveMQServerControl: <domain>:broker=<brokerName>
AddressControl: <domain>:broker=<brokerName>,component=addresses,address=<addressName>
QueueControl: <domain>:broker=<brokerName>,component=addresses,address=<addressName>,subcomponent=queues,routing-type=<routingType>,queue=<queueName>
DivertControl: <domain>:broker=<brokerName>,component=addresses,address=<addressName>,subcomponent=diverts,divert=<divertName>
ClusterConnectionControl: <domain>:broker=<brokerName>,component=cluster-connections,name=<clusterConnectionName>
AcceptorControl: <domain>:broker=<brokerName>,component=acceptors,name=<acceptorName>
BroadcastGroupControl: <domain>:broker=<brokerName>,component=broadcast-groups,name=<broadcastGroupName>
BridgeControl: <domain>:broker=<brokerName>,component=bridges,name=<bridgeName>
The "key" that you use will depend on the name of the attribute from the control that you want to inspect. That name will correspond to the "getter" of the attribute. You can see all the names of all the getters in the linked JavaDoc. For example, if you want to get the number of messages from a queue you'd use the key MessageCount since the getter is named getMessageCount().
The domain by default is org.apache.activemq.artemis and the default broker name is localhost so if you didn't explicitly configure either of these and you wanted to get the message count of the anycast queue "myQueue" on the address "myAddress" you would use something like this:
jmx["org.apache.activemq.artemis:broker=\"localhost\",component=addresses,address=\"myAddress\",subcomponent=queues,routing-type=\"anycast\",queue=\"myQueue\"",MessageCount]
This formatting is based on this Zabbix block post which is also discussed on this Zabbix forum thread.
To be clear, the JMXExample you cited uses a handy helper method named getQueueObjectName to construct the MBean's object name.
If you need to quickly get a broker up and running which supports remote JMX clients do the following:
Open the directory examples/features/standard/jmx in a terminal.
Run the example using mvn clean verify.
This will create a full broker instance in target/server0 which you can use as a template to configure your own. It includes modifications to broker.xml, management.xml, and artemis.profile (to set the java.rmi.server.hostname system property).
If you start this broker instance manually you can connect to it with JConsole or JVisualVM using service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi.

Using django-channels with django-rest-framework in the creation of mobile application

I already have a project writen in Django and I am able to use the django rest framework well with it. This project is actually based on django-oscar and I implemented some other features. I am now in the middle of working with the mobile version of this application and I am in need of realtime server updates like Sockets and I am aware of djnago channels. My question now is this, Is it possible to link django-rest framework with django-channels because if for example a user makes a purchase on the mobile app, the number of available products should decrease in real-time or if a user adds a product to cart the user should be a able to get an increased number of items immediately reflected witha notification badge and I feel this can be achieved by django channels. So how can I relate the rest API to django channels
URLRouter([
url(r"^longpoll/$", LongPollConsumer),
url(r"^notifications/(?P<stream>\w+)/$", LongPollConsumer),
url(r"", AsgiHandler),
])
If a http argument is not provided, it will default to the Django view system’s ASGI interface, channels.http.AsgiHandler, which means that for most projects that aren’t doing custom long-poll HTTP handling, you can simply not specify a http option and leave it to work the “normal” Django way.
If you want to split HTTP handling between long-poll handlers and Django views, use a URLRouter with channels.http.AsgiHandler specified as the last entry with a match-everything pattern.
The content above is from https://channels.readthedocs.io/en/latest/topics/routing.html#protocoltyperouter

Keycloak and Docker - Cannot set two types of URLs

I use standalone version of keycloak in docker-based application.
Since Keycloak 1.9.2 there is an "auth-server-url-for-backend-requests" attribute removed from keycloak properties.
This field was by me to indicate the internal ip address of auth server (inside a dock).
The external one (auth-server-url) is used for redirection purpose.
My question is: how to replace former auth-server-url-for-backend-request to solve a problem of having different network addresses inside docker and outside of it.
According to the following links, it appears you can use the same DNS for external requests as you would for internal. See these:
keycloak issue
http://keycloak.github.io/docs/userguide/keycloak-server/html_single/index.html#d4e4114
You should set the KEYCLOAK_FRONTEND_URL parameter in the Dockerfile or docker-compose.yml (if you use them). In other case your should set this parameter in Keycloak General settings UI.
Eg.:
It is quite tricky because you shouldn't set the real front-end's URL, however you should set the URL which is used by front-end. I have the same problem so you can see some examples in my SO question/answer

Spring-AMQP RPC container

Exist a container on the spring-amqp that support a reply-to feature?
I want make RPCs like https://www.rabbitmq.com/tutorials/tutorial-six-java.html, but using spring-amqp.
Yes. Documentation here.
On the server side, the message listener container, when used with a message listener adapter will automatically handle the replies. You can also use the template's ...receiveAndReply methods on the server side.
EDIT
Note that we now have Spring Boot implementations of all 6 tutorials.

Resources