karrieretutor / jitsi-prom-exporter

prometheus
Apache License 2.0
38 stars 26 forks source link

JVB instance should be recognized by MUC_NICKNAME instead of USERNAME #10

Open slykar opened 4 years ago

slykar commented 4 years ago

To make the configuration of JVB auto-scaling easier, you can reuse the same username and password for JVB to enter the MUC room. This is even suggested by the maintainers on the Jitsi forums. The thing that needs to be unique is the MUC_NICKNAME.

Right now the exporter identifies instances by the USERNAME, which in my case is always jvb. It would be great if the instance was recognized by the MUC_NICKNAME instead, which in my case is the machine hostname assigned by AWS, e.g. ip-10-0-0-78.

Note: I'm running jitsi-videobridge2

MiningPickaxe commented 4 years ago

Yup, with the current setup the output switches between the two bridges, depending on which bridge just published its information. This is currently a deal breaker for multi-jvb jitsi meet installations

chaosbiber commented 4 years ago

There are different methods to integrate other videobridge instances, but yes, I had the same problem. Quick hack:

diff --git a/exporter/main.go b/exporter/main.go
index f2c5287..0b6030c 100644
--- a/exporter/main.go
+++ b/exporter/main.go
@@ -216,7 +216,7 @@ func handlePresence(s xmpp.Sender, p stanza.Packet) {
        }

        if presence.Get(&Stats{}) && presence.Get(&User{}) {
-               var jvbJid string
+               // var jvbJid string
                var stats *Stats

                //check extensions
@@ -224,15 +224,15 @@ func handlePresence(s xmpp.Sender, p stanza.Packet) {
                        switch extension := e.(type) {
                        case *Stats:
                                stats = extension
-                       case *User:
+                               /*case *User:
                                for _, i := range extension.Items {
                                        jvbJid = i.Jid
-                               }
+                               }*/
                        }
                }

                //we want to keep track of jvbs across their reconnects of autoscaled sets
-               jvbCollector.Update(strings.Split(jvbJid, "@")[0], stats)
+               jvbCollector.Update(strings.Split(presence.From, "/")[1], stats)
        }
 }