mirror of
https://github.com/clearlinux/telemetrics-client.git
synced 2026-09-01 11:15:51 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1425173a9 | ||
|
|
98b36d5609 | ||
|
|
e59b75689e | ||
|
|
e301dad48e | ||
|
|
16d8abae81 | ||
|
|
4aa1f9f3c4 | ||
|
|
af35ee3a9d |
@@ -6,7 +6,7 @@ solution for Linux-based operating systems. Specifically, the front end
|
|||||||
component includes:
|
component includes:
|
||||||
|
|
||||||
- telemetrics probes that collect specific types of data from the operating
|
- telemetrics probes that collect specific types of data from the operating
|
||||||
system.
|
system. For more info on probes go [here](./src/probes).
|
||||||
|
|
||||||
- a library, libtelemetry, that telemetrics probes use to create telemetrics
|
- a library, libtelemetry, that telemetrics probes use to create telemetrics
|
||||||
records and send them to the daemon for further processing.
|
records and send them to the daemon for further processing.
|
||||||
@@ -178,6 +178,45 @@ The daemon uses the following configuration options from the configuration file:
|
|||||||
telemetry records locally only.
|
telemetry records locally only.
|
||||||
|
|
||||||
|
|
||||||
|
Data reported
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
The data reported by the telemetry client could be understood as two main sets:
|
||||||
|
metadata and a payload.
|
||||||
|
|
||||||
|
The metadata is used to report details of a machine's architecture. The
|
||||||
|
following are the metadata values currently collected (Record Format Version 4):
|
||||||
|
|
||||||
|
* record_format_version: version of the record, currently is 'Version 4'. This
|
||||||
|
value changes when new metadata is added.
|
||||||
|
* classification: this field is used to identify the type of record sent by a
|
||||||
|
specific client probe; classifications use the format DOMAIN/PROBE/REST, where
|
||||||
|
DOMAIN is the vendor of the probe, PROBE is the probe name, and REST is a
|
||||||
|
probe-defined field to classify what is contained in the payload.
|
||||||
|
* severity: this is an integer value between 1 and 4 where 1 is "low" and 4 is
|
||||||
|
"critical"
|
||||||
|
* machine_id: a machine identifier that is rotate every 3 days for privacy reasons.
|
||||||
|
* creation_timestamp: timestamp when the record was collected.
|
||||||
|
* arch: a string describing machine architecture i.e. 'x86_64'.
|
||||||
|
* host_type: a string with the combination of 'System Vendor', 'Product Name', and
|
||||||
|
'Product Version' read from dmi file system.
|
||||||
|
* build: OS build number.
|
||||||
|
* kernel_version: Kernel version.
|
||||||
|
* payload_format_version: version of the payload, currently is 'Version 1'.
|
||||||
|
* system_name: the value after 'ID=' from '/etc/os-release' (or distribution
|
||||||
|
provided folder)
|
||||||
|
* board_name: a string read from dmi file system that combines 'Board Name' and
|
||||||
|
'Board Vendor'.
|
||||||
|
* cpu_model: cpu model name extracted from '/proc/cpuinfo'.
|
||||||
|
* bios_version: BIOS version.
|
||||||
|
* event_id: an id to group multiple records if these were generated by a single
|
||||||
|
event occurrence.
|
||||||
|
|
||||||
|
The payload as mentioned above is reported by probes. The telemetry library adds
|
||||||
|
the metadata to the payload (done programatically when using library API) for
|
||||||
|
more information about probes go [here](./src/probes).
|
||||||
|
|
||||||
|
|
||||||
Machine id
|
Machine id
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_PREREQ([2.69])
|
AC_PREREQ([2.69])
|
||||||
AC_INIT([telemetrics-client], [1.16.0], [https://clearlinux.org/])
|
AC_INIT([telemetrics-client], [1.16.3], [https://clearlinux.org/])
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AM_INIT_AUTOMAKE([1.14 -Wall -Werror -Wno-extra-portability foreign subdir-objects])
|
AM_INIT_AUTOMAKE([1.14 -Wall -Werror -Wno-extra-portability foreign subdir-objects])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
@@ -23,7 +23,7 @@ AC_PROG_MAKE_SET
|
|||||||
# Checks for libraries.
|
# Checks for libraries.
|
||||||
|
|
||||||
# check >= 0.9.12 is required for TAP output
|
# check >= 0.9.12 is required for TAP output
|
||||||
PKG_CHECK_MODULES([CHECK], [check >= 0.9.12])
|
PKG_CHECK_MODULES([CHECK], [check >= 0.12])
|
||||||
PKG_CHECK_MODULES([CURL], [libcurl])
|
PKG_CHECK_MODULES([CURL], [libcurl])
|
||||||
AC_CHECK_LIB([elf], [elf_begin], [have_elflib=yes], [AC_MSG_ERROR([Unable to find libelf from elfutils])])
|
AC_CHECK_LIB([elf], [elf_begin], [have_elflib=yes], [AC_MSG_ERROR([Unable to find libelf from elfutils])])
|
||||||
AC_CHECK_LIB([dw], [dwfl_begin], [have_dwlib=yes], [AC_MSG_ERROR([Unable to find libdw from elfutils])])
|
AC_CHECK_LIB([dw], [dwfl_begin], [have_dwlib=yes], [AC_MSG_ERROR([Unable to find libdw from elfutils])])
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
kernel.core_pattern = |@bindir@/crashprobe -p %e -E %E -s %s
|
|
||||||
@@ -9,7 +9,6 @@ pathfix = @sed \
|
|||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
%D%/40-core-ulimit.conf \
|
%D%/40-core-ulimit.conf \
|
||||||
%D%/40-crash-probe.conf.in \
|
|
||||||
%D%/example.conf \
|
%D%/example.conf \
|
||||||
%D%/example.1.conf \
|
%D%/example.1.conf \
|
||||||
%D%/hprobe.service.in \
|
%D%/hprobe.service.in \
|
||||||
@@ -94,12 +93,6 @@ systemdunit_DATA = \
|
|||||||
%D%/telemd-update-trigger.service: %D%/telemd-update-trigger.service.in
|
%D%/telemd-update-trigger.service: %D%/telemd-update-trigger.service.in
|
||||||
$(pathfix) < $< > $@
|
$(pathfix) < $< > $@
|
||||||
|
|
||||||
sysctldir = @SYSTEMD_SYSCTLDIR@
|
|
||||||
sysctl_DATA = %D%/40-crash-probe.conf
|
|
||||||
|
|
||||||
%D%/40-crash-probe.conf: %D%/40-crash-probe.conf.in
|
|
||||||
$(pathfix) < $< > $@
|
|
||||||
|
|
||||||
systemconfdir = @SYSTEMD_SYSTEMCONFDIR@
|
systemconfdir = @SYSTEMD_SYSTEMCONFDIR@
|
||||||
systemconf_DATA = %D%/40-core-ulimit.conf
|
systemconf_DATA = %D%/40-core-ulimit.conf
|
||||||
|
|
||||||
@@ -111,7 +104,6 @@ clean-local:
|
|||||||
%D%/telemetrics.conf \
|
%D%/telemetrics.conf \
|
||||||
%D%/telemetrics-dirs.conf \
|
%D%/telemetrics-dirs.conf \
|
||||||
%D%/libtelemetry.pc \
|
%D%/libtelemetry.pc \
|
||||||
%D%/40-crash-probe.conf \
|
|
||||||
%D%/journal-probe.service \
|
%D%/journal-probe.service \
|
||||||
%D%/oops-probe.service \
|
%D%/oops-probe.service \
|
||||||
%D%/pstore-probe.service \
|
%D%/pstore-probe.service \
|
||||||
|
|||||||
@@ -344,9 +344,11 @@ TelemJournal *open_journal(const char *journal_file)
|
|||||||
struct TelemJournal *telem_journal;
|
struct TelemJournal *telem_journal;
|
||||||
|
|
||||||
// Use default location if journal_file parameter is NULL
|
// Use default location if journal_file parameter is NULL
|
||||||
fptr = (journal_file == NULL) ? fopen(JOURNAL_PATH, "a+") :
|
if (journal_file == NULL) {
|
||||||
fopen(journal_file, "a+");
|
fptr = fopen(JOURNAL_PATH, "a+");
|
||||||
|
} else {
|
||||||
|
fptr = fopen(journal_file, "a+");
|
||||||
|
}
|
||||||
if (fptr == NULL) {
|
if (fptr == NULL) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
perror("Error while opening journal file: ");
|
perror("Error while opening journal file: ");
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# Probes
|
||||||
|
|
||||||
|
The default probes provided along the telemetry client code are:
|
||||||
|
|
||||||
|
* bertprobe: this probe reports on the Boot Error Region Table if such
|
||||||
|
entry is found in ```/sys/firmware/acpi/tables/BERT```.
|
||||||
|
|
||||||
|
* crashprobe: This probe processes core dump files. It can be registered as
|
||||||
|
the kernel core file handler in /proc/sys/kernel/core_pattern.
|
||||||
|
|
||||||
|
* hprobe: a simple probe that sends a keep alive message. This probe can also
|
||||||
|
be useful for testing
|
||||||
|
|
||||||
|
* journalprobe: a probe that monitors the systemd journal for log messages
|
||||||
|
from failed services.
|
||||||
|
|
||||||
|
* oopsprobe: a probe to collect 'oops messages' when the kernel detects a
|
||||||
|
problem.
|
||||||
|
|
||||||
|
* pstoreprobe: probe to collect messages left on pstore filesystem.
|
||||||
|
|
||||||
|
* telem-record-gen: this is a "general-purpose probe" for sending custom
|
||||||
|
records on-the-fly. This tool can be used stand alone or as a part of a
|
||||||
|
script to implement a probe.
|
||||||
|
|
||||||
|
For example to generate an hprobe like message we can execute the following
|
||||||
|
command:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ telem-record-gen --class org.example/hello/world --payload hello
|
||||||
|
```
|
||||||
|
|
||||||
|
for more options use the ```--help``` switch i.e.:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ telem-record-gen --help
|
||||||
|
Usage:
|
||||||
|
telem-record-gen [OPTIONS] - create and send a custom telemetry record
|
||||||
|
|
||||||
|
Help Options:
|
||||||
|
-h, --help Show help options
|
||||||
|
|
||||||
|
Application Options:
|
||||||
|
-f, --config-file Path to configuration file (not implemented yet)
|
||||||
|
-V, --version Print the program version
|
||||||
|
-s, --severity Severity level (1-4) - (default 1)
|
||||||
|
-c, --class Classification level_1/level_2/level_3
|
||||||
|
-p, --payload Record body (max size = 8k)
|
||||||
|
-P, --payload-file File to read payload from
|
||||||
|
-R, --record-version Version number for format of payload (default 1)
|
||||||
|
-e, --event-id Event id to use in the record
|
||||||
|
|
||||||
|
```
|
||||||
+12
-4
@@ -20,11 +20,16 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "journal/journal.h"
|
#include "journal/journal.h"
|
||||||
|
|
||||||
|
static char *journal_file = "journal.txt";
|
||||||
|
static char *journal_print_file = "journal.print.txt";
|
||||||
static struct TelemJournal *journal = NULL;
|
static struct TelemJournal *journal = NULL;
|
||||||
static char *journal_file = TESTOOPSDIR "/journal.txt";
|
|
||||||
static char *eid = "00007766547776eb7fc478eb0eb43e43";
|
static char *eid = "00007766547776eb7fc478eb0eb43e43";
|
||||||
static int K = 20;
|
static int K = 20;
|
||||||
|
|
||||||
|
void teardown(void) {
|
||||||
|
remove(journal_file);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(check_open_journal)
|
START_TEST(check_open_journal)
|
||||||
{
|
{
|
||||||
struct TelemJournal *j = open_journal(journal_file);
|
struct TelemJournal *j = open_journal(journal_file);
|
||||||
@@ -108,6 +113,7 @@ void new_entry_teardown(void)
|
|||||||
close_journal(journal);
|
close_journal(journal);
|
||||||
journal = NULL;
|
journal = NULL;
|
||||||
}
|
}
|
||||||
|
remove(journal_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert_n_records(int n, struct TelemJournal *j)
|
void insert_n_records(int n, struct TelemJournal *j)
|
||||||
@@ -128,7 +134,7 @@ START_TEST(check_journal_file_prune)
|
|||||||
|
|
||||||
insert_n_records(j->record_count_limit * 2, j);
|
insert_n_records(j->record_count_limit * 2, j);
|
||||||
ck_assert_int_gt(j->record_count, j->record_count_limit);
|
ck_assert_int_gt(j->record_count, j->record_count_limit);
|
||||||
rc = prune_journal(j, TESTOOPSDIR);
|
rc = prune_journal(j, "./");
|
||||||
ck_assert(rc == 0);
|
ck_assert(rc == 0);
|
||||||
// Record count should always be below the limit + hysteresis
|
// Record count should always be below the limit + hysteresis
|
||||||
ck_assert_int_lt(j->record_count, j->record_count_limit + DEVIATION);
|
ck_assert_int_lt(j->record_count, j->record_count_limit + DEVIATION);
|
||||||
@@ -139,13 +145,12 @@ END_TEST
|
|||||||
void journal_entry_setup(void)
|
void journal_entry_setup(void)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
const char *journal_print = TESTOOPSDIR "/journal.print.txt";
|
|
||||||
|
|
||||||
if (journal) {
|
if (journal) {
|
||||||
close_journal(journal);
|
close_journal(journal);
|
||||||
}
|
}
|
||||||
|
|
||||||
journal = open_journal(journal_print);
|
journal = open_journal(journal_print_file);
|
||||||
|
|
||||||
insert_n_records(K, journal);
|
insert_n_records(K, journal);
|
||||||
/* Insert recors with specific values */
|
/* Insert recors with specific values */
|
||||||
@@ -188,6 +193,7 @@ END_TEST
|
|||||||
void journal_entry_teardown(void)
|
void journal_entry_teardown(void)
|
||||||
{
|
{
|
||||||
close_journal(journal);
|
close_journal(journal);
|
||||||
|
remove(journal_print_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
Suite *config_suite(void)
|
Suite *config_suite(void)
|
||||||
@@ -197,6 +203,7 @@ Suite *config_suite(void)
|
|||||||
|
|
||||||
// Individual unit tests are added to "test cases"
|
// Individual unit tests are added to "test cases"
|
||||||
TCase *t = tcase_create("journal");
|
TCase *t = tcase_create("journal");
|
||||||
|
tcase_add_unchecked_fixture(t, NULL, teardown);
|
||||||
tcase_add_test(t, check_open_journal);
|
tcase_add_test(t, check_open_journal);
|
||||||
tcase_add_test(t, check_unsuccessful_open_journal);
|
tcase_add_test(t, check_unsuccessful_open_journal);
|
||||||
suite_add_tcase(s, t);
|
suite_add_tcase(s, t);
|
||||||
@@ -211,6 +218,7 @@ Suite *config_suite(void)
|
|||||||
suite_add_tcase(s, t);
|
suite_add_tcase(s, t);
|
||||||
|
|
||||||
t = tcase_create("prunning journal");
|
t = tcase_create("prunning journal");
|
||||||
|
tcase_add_unchecked_fixture(t, NULL, teardown);
|
||||||
tcase_add_test(t, check_journal_file_prune);
|
tcase_add_test(t, check_journal_file_prune);
|
||||||
suite_add_tcase(s, t);
|
suite_add_tcase(s, t);
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -131,7 +131,6 @@ EXTRA_DIST += \
|
|||||||
|
|
||||||
%C%_check_journal_SOURCES = \
|
%C%_check_journal_SOURCES = \
|
||||||
%D%/check_journal.c \
|
%D%/check_journal.c \
|
||||||
src/journal/journal.h \
|
|
||||||
src/journal/journal.c \
|
src/journal/journal.c \
|
||||||
src/util.h \
|
src/util.h \
|
||||||
src/util.c
|
src/util.c
|
||||||
@@ -145,7 +144,10 @@ EXTRA_DIST += \
|
|||||||
|
|
||||||
%C%_check_libtelemetry_SOURCES = \
|
%C%_check_libtelemetry_SOURCES = \
|
||||||
%D%/check_libtelemetry.c \
|
%D%/check_libtelemetry.c \
|
||||||
src/telemetry.c
|
src/configuration.h \
|
||||||
|
src/util.h \
|
||||||
|
src/nica/hashmap.h \
|
||||||
|
src/nica/inifile.h
|
||||||
|
|
||||||
%C%_check_libtelemetry_CFLAGS = \
|
%C%_check_libtelemetry_CFLAGS = \
|
||||||
$(AM_CFLAGS) \
|
$(AM_CFLAGS) \
|
||||||
|
|||||||
Reference in New Issue
Block a user