~mjorgensen/pleroma-stats

0a1f71e96690eef44cafc02703a6f4430bd5e03b — Matthew Jorgensen 3 months ago 1098af5
Indented codeblock to improve list flow
1 files changed, 26 insertions(+), 26 deletions(-)

M README.md
M README.md => README.md +26 -26
@@ 22,32 22,32 @@ pipenv install

2. Create one Postgresql database for Grafana, in this example, 'pleroma_stats', with two tables:

```sql
CREATE DATABASE pleroma_stats WITH OWNER pleroma;
\c pleroma_stats;
CREATE TABLE stats(
DATETIME TIMESTAMPTZ PRIMARY KEY NOT NULL,
USERS INT,
USERS_HOUR INT,
POSTS INT,
POSTS_HOUR INT, POSTS_USERS INT,
INTERACTIONS INT,
ACTIVE INT, ACTIVE30 INT,
SERVERS INT, SERVERS_HOUR INT,
POSTS_ACTIVE INT,
FEDERATED_USERS INT, FEDERATED_USERS_HOUR INT,
FED_POSTS_HOUR INT, USED_DISK_SPACE INT,
DISC_SPACE_HOUR INT
);

CREATE TABLE unreached_servers(
SERVER VARCHAR(30),
SINCE TIMESTAMP,
DAYS VARCHAR(30),
INSERTED_AT TIMESTAMP PRIMARY KEY NOT NULL,
DATETIME TIMESTAMPTZ
);
```
    ```sql
    CREATE DATABASE pleroma_stats WITH OWNER pleroma;
    \c pleroma_stats;
    CREATE TABLE stats(
    DATETIME TIMESTAMPTZ PRIMARY KEY NOT NULL,
    USERS INT,
    USERS_HOUR INT,
    POSTS INT,
    POSTS_HOUR INT, POSTS_USERS INT,
    INTERACTIONS INT,
    ACTIVE INT, ACTIVE30 INT,
    SERVERS INT, SERVERS_HOUR INT,
    POSTS_ACTIVE INT,
    FEDERATED_USERS INT, FEDERATED_USERS_HOUR INT,
    FED_POSTS_HOUR INT, USED_DISK_SPACE INT,
    DISC_SPACE_HOUR INT
    );
    
    CREATE TABLE unreached_servers(
    SERVER VARCHAR(30),
    SINCE TIMESTAMP,
    DAYS VARCHAR(30),
    INSERTED_AT TIMESTAMP PRIMARY KEY NOT NULL,
    DATETIME TIMESTAMPTZ
    );
    ```

3. `pipenv run python pleroma-stats.py`
4. Use your favourite scheduling method to set `pleroma-stats.py` to run regularly, using pipenv.