Git Product home page Git Product logo

systeroid's Issues

Add a panic hook to reset terminal upon panic

Is your feature request related to a problem? Please describe.

When an unexpected error happens, the terminal is messed up.

Describe the solution you'd like

Add a custom panic hook. See: ratatui-org/templates#13

The code changes on this PR will add a panic hook, so if a problem happens and the program panics, before the program closes it will run the code inside the panic hook that will leave alternate screen and disable raw mode. This way, you won't have your terminal messed up if an unexpected error happens.

Describe alternatives you've considered

None.

Additional context

The implementation might be the same as the linked pull request above.

Use transparent background as default for TUI

Is your feature request related to a problem? Please describe.
Right now the default background color of systeroid-tui is black which is not great when it comes to different color schemes.

Describe the solution you'd like
Make transparent background as default - i.e. do not set a color (aka reset)

The default behavior should be the same as:

$ systeroid-tui --bg-color reset

One thing to note is this is a style-wise breaking change and potentially should be noted in README.md.

Describe alternatives you've considered
None.

Additional context
See #153

Support glob patterns while preloading

Is your feature request related to a problem? Please describe.
According to sysctl.d(5), following configuration entry should be supported:

key.pattern.*.with.glob = whatever

Describe the solution you'd like
Implement the functionality with using the globwalk or regex crate.

Describe alternatives you've considered
-

Additional context
In my tests, sysctl does not work properly as well while preloading the following configuration:

# contents of sysctl.conf
net.ipv4.conf.*.rp_filter = 2
$ sysctl -p sysctl.conf
sysctl: cannot stat /proc/sys/net/ipv4/conf/*/rp_filter: No such file or directory

$ systeroid -p sysctl.conf
systeroid: cannot stat /proc/sys/net/ipv4/conf/*/rp_filter: No such file or directory
systeroid: ambiguous parameter name: net.ipv4.conf.*.rp_filter

transparent background

It would be nice to be able to set transparent background or, if already possible, documented how to.

Or, maybe the background shouldn't be overridden with the default black, if that would be a way?

False documentation for parameters

Describe the bug
Current regex for parsing the documentation gives false results sometimes.

To reproduce

Here is a few examples:

$ systeroid -E fs.mount-max

mount-max
=========
This denotes the maximum number of mounts that may exist
in a mount namespace.

# rest is irrelevant

2. /proc/sys/fs/binfmt_misc
===========================
# ...
$ systeroid -E net.mptcp.enabled

# completely irrelevant

seg6_enabled - BOOL
===================
Accept or drop SR-enabled IPv6 packets on this interface.
# ...

Expected behavior
Correct part of the documentation is parsed for the given parameter.

Screenshots / Logs
-

Software information

  • Operating system: Arch GNU/Linux x86_64 5.17.1-arch1-1
  • Rust version: rustc 1.62.0-nightly (8f36334ca 2022-04-06)
  • Project version: 0.1.0-rc.1

Additional context
-

Compilation Failure - 'cargo install systeroid-tui'

Compiler is stable, rustc 1.72.0 (5680fa18f 2023-08-23)

Just a guess, maybe the pinned dependency version for ratatui has required an update? I see it's pinned to "=0.22.0" in systeroid-tui-0.4.3, but clearly I'm seeing 0.23.0 for some reason in the logs below.

   Compiling systeroid-tui v0.4.3
error[E0308]: mismatched types
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systeroid-tui-0.4.3/src/ui.rs:485:22
     |
485  |         .style_trace(Style::default().fg(TuiColor::DarkGray))
     |          ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found `Style`
     |          |
     |          arguments to this method are incorrect
     |
     = note: `Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.22.0/src/style.rs:252:1
     |
252  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1338:12
     |
1338 |     pub fn style_trace(mut self, style: Style) -> Self {
     |            ^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systeroid-tui-0.4.3/src/ui.rs:486:22
     |
486  |         .style_debug(Style::default().fg(TuiColor::Blue))
     |          ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found `Style`
     |          |
     |          arguments to this method are incorrect
     |
     = note: `Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.22.0/src/style.rs:252:1
     |
252  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1342:12
     |
1342 |     pub fn style_debug(mut self, style: Style) -> Self {
     |            ^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systeroid-tui-0.4.3/src/ui.rs:487:21
     |
487  |         .style_warn(Style::default().fg(TuiColor::Yellow))
     |          ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found `Style`
     |          |
     |          arguments to this method are incorrect
     |
     = note: `Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.22.0/src/style.rs:252:1
     |
252  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1330:12
     |
1330 |     pub fn style_warn(mut self, style: Style) -> Self {
     |            ^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systeroid-tui-0.4.3/src/ui.rs:488:22
     |
488  |         .style_error(Style::default().fg(TuiColor::Red))
     |          ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found `Style`
     |          |
     |          arguments to this method are incorrect
     |
     = note: `Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.22.0/src/style.rs:252:1
     |
252  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1326:12
     |
1326 |     pub fn style_error(mut self, style: Style) -> Self {
     |            ^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systeroid-tui-0.4.3/src/ui.rs:489:21
     |
489  |         .style_info(Style::default().fg(TuiColor::Green))
     |          ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found `Style`
     |          |
     |          arguments to this method are incorrect
     |
     = note: `Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.22.0/src/style.rs:252:1
     |
252  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1334:12
     |
1334 |     pub fn style_info(mut self, style: Style) -> Self {
     |            ^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systeroid-tui-0.4.3/src/ui.rs:490:26
     |
490  |         .highlight_style(colors.get_fg_style())
     |          --------------- ^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found `Style`
     |          |
     |          arguments to this method are incorrect
     |
     = note: `Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.22.0/src/style.rs:252:1
     |
252  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1310:12
     |
1310 |     pub fn highlight_style(mut self, style: Style) -> Self {
     |            ^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systeroid-tui-0.4.3/src/ui.rs:491:23
     |
491  |         .border_style(colors.get_fg_style())
     |          ------------ ^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found `Style`
     |          |
     |          arguments to this method are incorrect
     |
     = note: `Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.22.0/src/style.rs:252:1
     |
252  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1314:12
     |
1314 |     pub fn border_style(mut self, style: Style) -> Self {
     |            ^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systeroid-tui-0.4.3/src/ui.rs:492:22
     |
492  |         .border_type(BorderType::Rounded)
     |          ----------- ^^^^^^^^^^^^^^^^^^^ expected `BorderType`, found a different `BorderType`
     |          |
     |          arguments to this method are incorrect
     |
     = note: `BorderType` and `BorderType` have similar names, but are actually distinct types
note: `BorderType` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.22.0/src/widgets/block.rs:14:1
     |
14   | pub enum BorderType {
     | ^^^^^^^^^^^^^^^^^^^
note: `BorderType` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/widgets/block.rs:16:1
     |
16   | pub enum BorderType {
     | ^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1318:12
     |
1318 |     pub fn border_type(mut self, border_type: BorderType) -> Self {
     |            ^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systeroid-tui-0.4.3/src/ui.rs:493:16
     |
493  |         .style(colors.get_bg_style())
     |          ----- ^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found `Style`
     |          |
     |          arguments to this method are incorrect
     |
     = note: `Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.22.0/src/style.rs:252:1
     |
252  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1322:12
     |
1322 |     pub fn style(mut self, style: Style) -> Self {
     |            ^^^^^

error[E0277]: the trait bound `TuiLoggerSmartWidget<'_>: Widget` is not satisfied
   --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systeroid-tui-0.4.3/src/ui.rs:501:25
    |
501 |     frame.render_widget(logger_widget, rect);
    |           ------------- ^^^^^^^^^^^^^ the trait `Widget` is not implemented for `TuiLoggerSmartWidget<'_>`
    |           |
    |           required by a bound introduced by this call
    |
    = help: the following other types implement trait `Widget`:
              Canvas<'a, F>
              LineGauge<'a>
              BarChart<'a>
              ratatui::widgets::Block<'a>
              Chart<'a>
              Clear
              Gauge<'a>
              List<'a>
            and 4 others
note: required by a bound in `Frame::<'a, B>::render_widget`
   --> /home/d/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.22.0/src/terminal.rs:89:12
    |
87  |     pub fn render_widget<W>(&mut self, widget: W, area: Rect)
    |            ------------- required by a bound in this associated function
88  |     where
89  |         W: Widget,
    |            ^^^^^^ required by this bound in `Frame::<'a, B>::render_widget`

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `systeroid-tui` (lib) due to 10 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `systeroid-tui v0.4.3`, intermediate artifacts can be found at `/tmp/cargo-installGz8EVJ`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Vector values are not separated in TUI

Describe the bug
In TUI mode, vector of integers are not correctly separated.

To reproduce

systeroid-tui -q  net.ipv4.tcp_mem

Expected behavior

tcp_mem is a vector of 3 intergers, 182769243695365538 should be displayed as 182769 243695 365538

Screenshots / Logs

sc-20220417-114845

Software information

  • Operating system: x86_64 GNU/Linux 5.17.3-arch1-1
  • Rust version: rustc 1.61.0-nightly (6af09d250 2022-04-03)
  • Project version: master, d65f8f6

Switch to `ratatui`

Is your feature request related to a problem? Please describe.

ratatui is the actively maintained fork of tui-rs and it would be nice to switch to it.

Describe the solution you'd like

Update Cargo.{toml,lock} according to the instructions.

Describe alternatives you've considered

None.

Additional context

ratatui had a new release recently and there is a bug fix release on the way. It would be nice to wait until ratatui-org/ratatui#110 is merged.

`systeroid` does not list sub/child sections as `sysctl` does

Describe the bug
For sub sections, x.y or deeper, systeroid does not show the expected output but instead a false error message, as in that the directory with the information is there.

To reproduce
Run systeroid net.ipv4, for example.

Expected behavior
Show all sub/child variables of net.ipv4 (for example) as sysctl net.ipv4 does, or as is currently shown by passing the -r flag to systeroid, systeroid -r net.ipv4.

Screenshots / Logs

$ systeroid net.ipv4
systeroid: cannot stat /proc/sys/net/ipv4: No such file or directory
$ ls -ld /proc/sys/net/ipv4
dr-xr-xr-x - root  4 Sep 22:18 /proc/sys/net/ipv4/

Software information

  • Operating system: Alpinelinux 3.17_alpha20220809
  • Rust version: 1.63.0
  • Project version: 0.2.1

Add a configuration file

Is your feature request related to a problem? Please describe.
Currently there is no way to configure the default settings of systeroid other than using the command-line arguments. These settings include kernel section colors, TUI foreground/background colors and default argument values.

Describe the solution you'd like
Support configuring the settings with a configuration file. INI format could be used.

Describe alternatives you've considered
-

Additional context
There is already a config module in the core library. This struct type could potentially be used while implementing.

RUSTSEC-2022-0048: xml-rs is Unmaintained

xml-rs is Unmaintained

Details
Status unmaintained
Package xml-rs
Version 0.8.4
URL https://github.com/netvl/xml-rs/issues
Date 2022-01-26

xml-rs is a XML parser has open issues around parsing including integer
overflows / panics that may or may not be an issue with untrusted data.

Together with these open issues with Unmaintained status xml-rs
may or may not be suited to parse untrusted data.

Alternatives

See advisory page for additional details.

Support saving changed values

Describe the solution you'd like
Support saving changed values to a specified file, i.e. 99-local.conf (possibly specified in a config file in RFE #12)

Describe alternatives you've considered
Could also dump changed values to terminal in a format suitable for copy/paste

Verbose logging for TUI

Is your feature request related to a problem? Please describe.
Printing to stdout is not possible while running TUI since the output is locked by the terminal backend (termion). This causes verbose logging to be suppressed.

Describe the solution you'd like
Add a new command-line flag named --verbose and somehow enable verbose logging while running the TUI.

Describe alternatives you've considered
-

Additional context
This will be useful when some of the parameters cannot be retrieved due to insufficient permissions and error logs are printed. Right now there is no way of telling when the parameter list is fetched without errors when the TUI is launched.

termion error handler should be updated

Describe the bug
Panic handler for termion does not work correctly, as we implemented new one within orhun/kmon#141

To reproduce
You can inject panic!() somewhere in the systeroid-tui(I did it within lib.rs file) and it will basically mess up your terminal emulator.

Expected behavior
As it is implemented in orhun/kmon#141, panic handler should work same and correctly to not to mess up terminal.

Screenshots / Logs
image

Software information

  • Operating system: Arch GNU/Linux x86_64 | 6.8.2-arch2-1
  • Rust version: rustc 1.77.1 (7cf61ebde 2024-03-27)
  • Project version: 0.4.4
  • Terminal Emulator: Kitty 0.33

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.