schema work

This commit is contained in:
2023-04-14 04:53:13 -07:00
parent 042ddf0e34
commit 7c910144f4
2 changed files with 340 additions and 68 deletions

View File

@@ -1,68 +0,0 @@
Jarvis — Today at 8:23 PM
@EagleTrooper let's use this instead
to save blowing up the recruiters notifications
on recruitment
EagleTrooper — Today at 8:23 PM
Yeah keep the recruitment clean. I understand Im a recruiter / NCO / admin for the community in involved in.
Alright,
I am working on developing a dashboard that gives historical stats with our server as well as our missions that run Performance / FPS / Memory Usage / etc. During my research i came across your groups Repo and it appears that you are doing something very similar to what I wanted to do. I did read through just to get an idea unfortunately there was some gaps in the implementation and i was hoping to speak to someone about how it was done with your group as well as if they would be so kind as to provide pointers and insight so that I may implement something very similar.
Jarvis — Today at 8:26 PM
Do you know how to setup a Grafana/InfluxDB stack?
EagleTrooper — Today at 8:27 PM
Already have it setup (Background in IT and Cloud Network Engineering).
Sweetwater.I — Today at 8:27 PM
u can see our dashboard here if u wanna see what cavmetrics extension is outputting.
https://metrics.7cav.us/d/NED-gV3Mz/arma3?orgId=1&refresh=10s
Jarvis — Today at 8:28 PM
It's basically just arma -> influx -> grafana
Sweetwater.I — Today at 8:28 PM
but yeah, influxdb+grafana is what we do
Jarvis — Today at 8:28 PM
The cavmetrics addon you see is the arma extension
EagleTrooper — Today at 8:28 PM
Yep understood the workflow and that was very clear. I believe the piece im missing or dont understand is the dll creation / implementation
Jarvis — Today at 8:28 PM
If you know influx/grafana, you're 2/3rds of the way there
Just git clone the cavmetrics repo
EagleTrooper — Today at 8:29 PM
I believe it was the Arma-Influx?
That was the piece that i was not clear on. Unless i was misunderstanding it still required a compiled DLL
Jarvis — Today at 8:29 PM
the a3_influx dll is inside of the git repo
so == a DLL but linux
we run our servers on linux
EagleTrooper — Today at 8:30 PM
Unfortuantly it looks like its a .so
Sweetwater.I — Today at 8:30 PM
use the arma-influx repo to build the extension
EagleTrooper — Today at 8:30 PM
Yeah we have windows :/
Sweetwater.I — Today at 8:30 PM
cavmetrics is what we called the packaged extension.
on the repo
Jarvis — Today at 8:30 PM
https://github.com/7Cav/Arma-Influx
GitHub
GitHub - 7Cav/Arma-Influx: Arma Extension for sending metrics to In...
Arma Extension for sending metrics to InfluxDB. Contribute to 7Cav/Arma-Influx development by creating an account on GitHub.
Just compile that for dll
it's an arma ext written in go
Liber.N — Today at 8:31 PM
Cavmetrics is an arma addon thats calls to arma influx extension
Jarvis — Today at 8:31 PM
you'll need to change the makefile on that repo tho
EagleTrooper — Today at 8:32 PM
does it need to be labeld armago? or a3influx?
If that is what your referring to then it appears i do have an understanding of it and something else is missing outside of my imediate understanding and may not have anything you can provide input on. I will review the implementation again and see if I can get any further.
I do appreciate the input and help.
Jarvis — Today at 8:35 PM
no probs, it's a long road but found it worth it in the end
https://metrics.7cav.us/
Specifically - https://metrics.7cav.us/d/NED-gV3Mz/arma3?orgId=1&refresh=10s
EagleTrooper — Today at 8:36 PM
I will take a look! Keep on Keeping on and again I appreciate the friendly response!
Jarvis — Today at 8:36 PM
You'll need to update these for your influx db host - https://github.com/7Cav/cav_metrics/blob/dev/%40CavMetrics/addons/CavMetrics/functions/fn_send.sqf#L9-L12

340
TimescaleDB/buildSchema.sql Normal file
View File

@@ -0,0 +1,340 @@
-- This script was generated by the ERD tool in pgAdmin 4.
-- Please log an issue at https://redmine.postgresql.org/projects/pgadmin4/issues/new if you find any bugs, including reproduction steps.
BEGIN;
CREATE SCHEMA units;
CREATE SCHEMA vehicles;
CREATE SCHEMA players;
CREATE SCHEMA missions;
CREATE SCHEMA events;
CREATE TABLE
IF NOT EXISTS units."State" (
"timestamp" timestamp
with
time zone NOT NULL,
mission_id integer NOT NULL,
net_id text COLLATE pg_catalog."default" NOT NULL,
player_uid text COLLATE pg_catalog."default" NOT NULL DEFAULT '-1':: integer,
is_alive boolean NOT NULL,
is_afk boolean,
is_speaking smallint,
unit_name text COLLATE pg_catalog."default" NOT NULL,
side text COLLATE pg_catalog."default" NOT NULL,
"position" point NOT NULL,
direction numeric(2, 0) NOT NULL,
health numeric(2, 0),
traits text [] COLLATE pg_catalog."default",
CONSTRAINT "UnitStates_pkey" PRIMARY KEY (
net_id,
"timestamp",
player_uid,
mission_id
)
);
COMMENT ON
TABLE
units."State" IS 'Reflects a unit''s (soldier''s) state during a mission. Can be AI (player_uid = -1) or a player.';
CREATE TABLE
IF NOT EXISTS units."Identity" (
"timestamp" timestamp
with
time zone NOT NULL,
mission_id integer NOT NULL,
net_id text COLLATE pg_catalog."default" NOT NULL,
player_uid text COLLATE pg_catalog."default" NOT NULL DEFAULT '-1':: integer,
class_name text COLLATE pg_catalog."default" NOT NULL,
display_name text,
side text,
role_description text COLLATE pg_catalog."default",
traits text [] COLLATE pg_catalog."default",
CONSTRAINT "Units_pkey" PRIMARY KEY (
mission_id,
net_id,
"timestamp",
player_uid
)
);
COMMENT ON
TABLE
units."Identity" IS 'This is polled periodically during the mission to gather static and less-dynamic traits of units (soldiers).';
CREATE TABLE
IF NOT EXISTS events."Chat" (
id bigserial NOT NULL,
"timestamp" timestamp
with
time zone NOT NULL,
mission_id integer NOT NULL,
player_uid text COLLATE pg_catalog."default" NOT NULL DEFAULT -1,
channel integer,
owner integer,
name text COLLATE pg_catalog."default",
"from" text COLLATE pg_catalog."default",
text text COLLATE pg_catalog."default",
"forcedDisplay" boolean,
"isPlayerMessage" boolean,
"sentenceType" integer,
"chatMessageType" integer,
CONSTRAINT "Chat_pkey" PRIMARY KEY (
"timestamp",
mission_id,
player_uid,
id
),
UNIQUE (id)
);
CREATE TABLE
IF NOT EXISTS missions."Played" (
id serial NOT NULL,
start_time_utc timestamp
with
time zone NOT NULL,
start_time_game timestamp
with
time zone NOT NULL,
world_name text COLLATE pg_catalog."default" NOT NULL,
briefing_name text COLLATE pg_catalog."default" NOT NULL,
mission_name text COLLATE pg_catalog."default" NOT NULL,
mission_name_source text COLLATE pg_catalog."default" NOT NULL,
author text COLLATE pg_catalog."default" NOT NULL,
server_name text COLLATE pg_catalog."default" NOT NULL,
server_mods json,
ace_medical boolean,
radio_tfar boolean,
radio_acre boolean,
duration interval,
version_addon integer [] NOT NULL,
version_extension integer [] NOT NULL,
tags text [] COLLATE pg_catalog."default",
CONSTRAINT "MissionsRun_pkey" PRIMARY KEY (id, world_name, start_time_utc),
CONSTRAINT "MissionsRun_id_start_time_utc_key" UNIQUE (id, start_time_utc),
UNIQUE (id)
);
COMMENT ON
TABLE
missions."Played" IS 'Contains core mission data, recorded at mission init. The IDs here are referenced by many other areas to "place" them.';
CREATE TABLE
IF NOT EXISTS players."ConnectionsMission" (
id bigserial NOT NULL,
"timestamp" timestamp
with
time zone NOT NULL,
mission_id integer NOT NULL,
player_uid text COLLATE pg_catalog."default" NOT NULL,
event_type text COLLATE pg_catalog."default" NOT NULL,
profile_name text COLLATE pg_catalog."default" NOT NULL,
display_name text COLLATE pg_catalog."default" NOT NULL,
steam_name text COLLATE pg_catalog."default" NOT NULL,
is_jip boolean,
CONSTRAINT "ConnectionsMission_pkey" PRIMARY KEY (
player_uid,
"timestamp",
profile_name,
mission_id,
id
),
UNIQUE (
"timestamp",
mission_id,
player_uid,
id
)
);
CREATE TABLE
IF NOT EXISTS units."Inventory" (
"timestamp" timestamp
with
time zone NOT NULL,
mission_id integer NOT NULL,
net_id text NOT NULL,
player_uid text NOT NULL DEFAULT -1,
inventory jsonb NOT NULL,
PRIMARY KEY (
"timestamp",
net_id,
mission_id,
player_uid
)
);
COMMENT ON
TABLE
units."Inventory" IS 'This is used to track the inventory state of units.';
CREATE TABLE
IF NOT EXISTS players."ConnectionsServer" (
"timestamp" timestamp
with
time zone NOT NULL,
player_uid text COLLATE pg_catalog."default" NOT NULL,
event_type text COLLATE pg_catalog."default" NOT NULL,
profile_name text COLLATE pg_catalog."default" NOT NULL,
display_name text COLLATE pg_catalog."default" NOT NULL,
steam_name text COLLATE pg_catalog."default" NOT NULL,
is_jip boolean,
CONSTRAINT "PlayersObserved_pkey" PRIMARY KEY (
player_uid,
"timestamp",
profile_name
)
);
CREATE TABLE
IF NOT EXISTS missions."Environment" (
"timestamp" timestamp
with
time zone NOT NULL,
mission_id integer NOT NULL,
fog numeric(2),
overcast numeric(2),
rain numeric(2),
humidity numeric(2),
waves numeric(2),
"windDir" numeric(2),
"windStr" numeric(2),
gusts numeric(2),
lightnings numeric(2),
"moonIntensity" numeric(2),
"moonPhase" numeric(2),
"sunOrMoon" numeric(2),
PRIMARY KEY ("timestamp", mission_id)
);
COMMENT ON
TABLE
missions."Environment" IS 'Contains periodically collected environmental information during missions.';
CREATE TABLE
IF NOT EXISTS vehicles."Identity" (
"timestamp" timestamp
with
time zone NOT NULL,
mission_id integer NOT NULL,
net_id text NOT NULL,
class_name text NOT NULL,
display_name text,
customization jsonb,
weapons jsonb,
PRIMARY KEY (
"timestamp",
mission_id,
net_id
)
);
COMMENT ON
TABLE
vehicles."Identity" IS 'Periodically polled identity information about a vehicle.';
CREATE TABLE
IF NOT EXISTS vehicles."State" (
"timestamp" timestamp
with
time zone NOT NULL,
mission_id integer NOT NULL,
net_id text NOT NULL,
is_alive boolean,
side text,
"position" point NOT NULL,
direction numeric(2),
health numeric(2),
crew text [],
PRIMARY KEY (
"timestamp",
mission_id,
net_id
)
);
COMMENT ON
TABLE
vehicles."State" IS 'State information about vehicles. Crew is an array of net_id to be referenced against the Unit tables.';
CREATE TABLE
IF NOT EXISTS players."AllObserved" (
id serial NOT NULL,
player_uid text NOT NULL,
PRIMARY KEY (id, player_uid),
UNIQUE (player_uid)
);
ALTER TABLE
IF EXISTS units."State"
ADD
FOREIGN KEY (mission_id) REFERENCES missions."Played" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS units."State"
ADD
FOREIGN KEY (player_uid) REFERENCES players."AllObserved" (player_uid) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS units."Identity"
ADD
FOREIGN KEY (mission_id) REFERENCES missions."Played" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS units."Identity"
ADD
FOREIGN KEY (player_uid) REFERENCES players."AllObserved" (player_uid) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS events."Chat"
ADD
FOREIGN KEY (mission_id) REFERENCES missions."Played" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS events."Chat"
ADD
FOREIGN KEY (player_uid) REFERENCES players."AllObserved" (player_uid) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS players."ConnectionsMission"
ADD
FOREIGN KEY (mission_id) REFERENCES missions."Played" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS players."ConnectionsMission"
ADD
FOREIGN KEY (player_uid) REFERENCES players."AllObserved" (player_uid) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS units."Inventory"
ADD
FOREIGN KEY (mission_id) REFERENCES missions."Played" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS units."Inventory"
ADD
FOREIGN KEY (player_uid) REFERENCES players."AllObserved" (player_uid) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS missions."Environment"
ADD
FOREIGN KEY (mission_id) REFERENCES missions."Played" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS vehicles."Identity"
ADD
FOREIGN KEY (mission_id) REFERENCES missions."Played" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
ALTER TABLE
IF EXISTS vehicles."State"
ADD
FOREIGN KEY (mission_id) REFERENCES missions."Played" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION NOT VALID;
END;