Module dataview

Module dataview 

Source
Expand description

Geneos Toolkit library for building data samplers and integrations

This library provides utilities for creating Geneos Dataviews, handling environment variables (including encrypted ones), and other helpers for working with the Geneos Toolkit.

Rows and columns are ordered by the order in which they are first added to the Dataview.

§Example

use geneos_toolkit::prelude::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let clear_env_var = get_var_or("CLEAR_ENV_VAR", "Default")?;

    let dataview = Dataview::builder()
        .set_row_header("Process")
        .add_headline("Hostname", &hostname::get().unwrap_or_default().to_string_lossy())
        .add_headline("Timestamp", &chrono::Utc::now().to_rfc3339())
        .add_headline("Clear Env Var", &clear_env_var)
        .add_value("process1", "Status", "Running")
        .add_value("process1", "CPU", "2.5%")
        .add_value("process1", "Memory", "150MB")
        .build()?;

    println!("{}", dataview);
    Ok(())
}

Structs§

Dataview
A Geneos Dataview object.
DataviewBuilder
A Builder for the Dataview struct.
Row
A helper struct to build a row of data.

Enums§

DataviewError

Functions§

print_result_and_exit
Prints the result of a Dataview operation and exits the program.