mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Dynamic hostname support
This commit is contained in:
parent
0f2707b4f1
commit
5ce20c48bc
@ -13,6 +13,8 @@ StatsD.server = 'monitor:8125'
|
|||||||
StatsD.logger = Logger.new(STDERR)
|
StatsD.logger = Logger.new(STDERR)
|
||||||
StatsD.mode = 'production'
|
StatsD.mode = 'production'
|
||||||
|
|
||||||
|
hostname = Socket.gethostname
|
||||||
|
|
||||||
loop do
|
loop do
|
||||||
server_count = 0
|
server_count = 0
|
||||||
client_count = 0
|
client_count = 0
|
||||||
@ -30,9 +32,9 @@ loop do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
StatsD.gauge('tmate.servers', server_count)
|
StatsD.gauge("tmate.#{hostname}.servers", server_count)
|
||||||
StatsD.gauge('tmate.clients', client_count)
|
StatsD.gauge("tmate.#{hostname}.clients", client_count)
|
||||||
StatsD.gauge('tmate.unique_ips', ips.uniq.count)
|
StatsD.gauge("tmate.#{hostname}.unique_ips", ips.uniq.count)
|
||||||
|
|
||||||
sleep 10
|
sleep 10
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include "tmate.h"
|
#include "tmate.h"
|
||||||
|
|
||||||
char *tmate_left_status, *tmate_right_status;
|
char *tmate_left_status, *tmate_right_status;
|
||||||
@ -97,6 +98,7 @@ static void unpack_array(struct tmate_unpacker *uk,
|
|||||||
|
|
||||||
static void tmate_header(struct tmate_unpacker *uk)
|
static void tmate_header(struct tmate_unpacker *uk)
|
||||||
{
|
{
|
||||||
|
char hostname[128];
|
||||||
int protocol = unpack_int(uk);
|
int protocol = unpack_int(uk);
|
||||||
|
|
||||||
if (protocol != 1)
|
if (protocol != 1)
|
||||||
@ -104,8 +106,11 @@ static void tmate_header(struct tmate_unpacker *uk)
|
|||||||
|
|
||||||
tmate_debug("new master, protocol version: %d", protocol);
|
tmate_debug("new master, protocol version: %d", protocol);
|
||||||
|
|
||||||
tmate_notify("Remote session: ssh %s@%s",
|
if (gethostname(hostname, sizeof(hostname)) < 0)
|
||||||
tmate_session_token, TMATE_HOST);
|
tmate_fatal("cannot get hostname");
|
||||||
|
|
||||||
|
tmate_notify("Remote session: ssh %s@%s.%s",
|
||||||
|
tmate_session_token, hostname, TMATE_DOMAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern u_int next_window_pane_id;
|
extern u_int next_window_pane_id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user