Module sysbot.modules.linux.sysinfo
Linux System Information Module
This module provides methods for retrieving system information on Linux systems, including OS details, hostname, uptime, kernel version, CPU, memory, and hardware information.
Classes
class Sysinfo-
System information retrieval class for Linux systems.
Ancestors
Methods
def architecture(self, alias: str, **kwargs) ‑> str-
Get the system architecture.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
System architecture (e.g., x86_64, aarch64).
def cpu(self, alias: str, **kwargs) ‑> dict-
Get CPU information.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
Dictionary containing CPU details from lscpu.
def datetime_utc(self, alias: str) ‑> str-
Get current date and time in UTC.
Args
alias- Session alias for the connection.
Returns
Date and time in UTC formatted as 'YYYY/MM/DD HH:MM'.
def dns(self, alias: str) ‑> list[str]-
Get configured DNS nameservers.
Args
alias- Session alias for the connection.
Returns
List of DNS server IP addresses.
def domain(self, alias: str, **kwargs) ‑> str-
Get the DNS domain name.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
DNS domain name.
def env(self, alias: str, **kwargs) ‑> dict-
Get environment variables.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
Dictionary of environment variables and their values.
def fqdn(self, alias: str, **kwargs) ‑> str-
Get the fully qualified domain name (FQDN).
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
Fully qualified domain name.
def hostname(self, alias: str, **kwargs) ‑> str-
Get the system hostname (short name).
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
System hostname without domain.
def kernel(self, alias: str, **kwargs) ‑> str-
Get the kernel version.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
Kernel version string.
def keyboard(self, alias: str, **kwargs) ‑> str-
Get the keyboard layout.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
Keyboard layout name.
def lsblk(self, alias: str, **kwargs) ‑> dict-
Get block device information.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
Dictionary containing block device information in JSON format.
def ntp_server(self, alias: str) ‑> list[str]-
Get configured NTP servers from chrony configuration.
Args
alias- Session alias for the connection.
Returns
List of NTP server addresses.
def os_release(self, alias: str, **kwargs) ‑> dict-
Get operating system release information.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
Dictionary containing OS release information from /etc/os-release.
def process(self, alias: str, **kwargs) ‑> dict-
Get list of running processes.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
Dictionary of processes indexed by PID with user, command, CPU, and memory info.
def ram(self, alias: str, **kwargs) ‑> dict-
Get memory (RAM) information.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
Dictionary containing memory statistics with values and units.
def sysctl(self, alias: str, variable: str) ‑> str-
Get a kernel parameter value using sysctl.
Args
alias- Session alias for the connection.
variable- Sysctl variable name (e.g., 'kernel.hostname').
Returns
Value of the sysctl variable.
def timezone(self, alias: str, **kwargs) ‑> str-
Get the system timezone.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
Timezone name (e.g., America/New_York, Europe/Paris).
def uptime(self, alias: str, **kwargs) ‑> str-
Get system uptime in a human-readable format.
Args
alias- Session alias for the connection.
**kwargs- Additional command execution options.
Returns
System uptime as a formatted string.