Inventory UI
Version 1 (UNSTABLE): cmk.inventory_ui.v1_unstable
Warning
This version of the API is work in progress and not yet stable. It is not recommended to use this version in production systems.
However: we do intend to stabilize this API version in the future and release it, so you are encouraged to experiment and give us feedback.
Scope
This API provides functionality to create user interfaces for hardware/software inventory entries.
- class AgeNotation
Bases:
objectA unit with the age notation first computes <NOW> - <NUMBER> and then formats the computed value with the following magnitudes: µs, ms, s, min, h, d, y.
- class Alignment(*values)
Bases:
Enum
- class AutoPrecision(digits)
Bases:
objectA unit with auto precision rounds the fractional part to the given digits or to the latest non-zero digit.
- class BackgroundColor(*values)
Bases:
Enum
- class BoolField(title, *, render_true=Label('Yes'), render_false=Label('No'), style=<function BoolField.<lambda>>)
Bases:
object- Parameters:
title (
Title) – A titlerender_true (
Label|str) – Rendering of the value ‘True’render_false (
Label|str) – Rendering of the value ‘False’style (
Callable[[bool],Iterable[Alignment|BackgroundColor|LabelColor]]) – A function which returns alignments, background or label colors
- class ChoiceField(title, *, mapping, style=<function ChoiceField.<lambda>>)
Bases:
Generic[T]- Parameters:
title (
Title) – A titlemappings – Maps the original value to a readable label
style (
Callable[[TypeVar(T,int,float,str)],Iterable[Alignment|BackgroundColor|LabelColor]]) – A function which returns alignments, background or label colors
- class Comparable(*args, **kwargs)
Bases:
ProtocolAn object which is comparable, ie. it supports equal, lower and greater comparisons
- class DecimalNotation(symbol)
Bases:
objectA unit with decimal notation has no special format.
- class EngineeringScientificNotation(symbol)
Bases:
objectA unit with the engineering scientific notation formats a number as following: m * 10**n, where 1 <= |m| < 1000 and n % 3 == 0.
- class IECNotation(symbol)
Bases:
objectA unit with the IEC notation formats a number with the following magnitudes: “”, Ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi. Positive number below one use the decimal notation.
- class Label(_arg, *, _modifier=None)
Bases:
_Localizable
- class LabelColor(*values)
Bases:
Enum
- class Node(*, name, title, path, attributes=<factory>, table=Table(columns={}, view=None))
Bases:
object
- class NumberField(title, *, render=<class 'str'>, style=<function NumberField.<lambda>>)
Bases:
object- Parameters:
title (
Title) – A titlerender (
Callable[[int|float],Label|str] |Unit) – Rendering of a numerical valuestyle (
Callable[[int|float],Iterable[Alignment|BackgroundColor|LabelColor]]) – A function which returns alignments, background or label colors
- render
alias of
str
- class SINotation(symbol)
Bases:
objectA unit with the SI notation formats a number with the following magnitudes: y, z, a, f, p, n, µ, m, “”, k, M, G, T, P, E, Z, Y.
- class StandardScientificNotation(symbol)
Bases:
objectA unit with the standard scientific notation formats a number as following: m * 10**n, where 1 <= |m| < 10.
- class StrictPrecision(digits)
Bases:
objectA unit with strict precision rounds the fractional part to the given digits.
- class Table(columns=<factory>, view=None)
Bases:
object- Parameters:
columns (
TypeAliasType) – Specifies fields for columnsview (
View|None) – A view
- class TextField(title, *, render=<function TextField.<lambda>>, style=<function TextField.<lambda>>, sort_key=None)
Bases:
object- Parameters:
title (
Title) – A titlerender (
Callable[[str],Label|str]) – Rendering of a stringstyle (
Callable[[str],Iterable[Alignment|BackgroundColor|LabelColor]]) – A function which returns alignments, background or label colorssort_key (
Callable[[str],Comparable] |None) – Enables rich comparisons of strings, ie. lower, lower equal, greater, greater equal
- class TimeNotation
Bases:
objectA unit with the time notation formats a number with the following magnitudes: µs, ms, s, min, h, d, y.
- class Title(_arg, *, _modifier=None)
Bases:
_Localizable
- class Unit(notation, precision=AutoPrecision(digits=2))
Bases:
objectDefines a unit which can be used within metrics and metric operations.
Examples
>>> Unit(DecimalNotation(""), StrictPrecision(0)) # rendered as integer Unit(notation=DecimalNotation(symbol=''), precision=StrictPrecision(digits=0))
>>> Unit(DecimalNotation(""), StrictPrecision(2)) # rendered as float with two digits Unit(notation=DecimalNotation(symbol=''), precision=StrictPrecision(digits=2))
>>> Unit(SINotation("bytes")) # bytes which are scaled with SI prefixes Unit(notation=SINotation(symbol='bytes'), precision=AutoPrecision(digits=2))
>>> Unit(IECNotation("bits")) # bits which are scaled with IEC prefixes Unit(notation=IECNotation(symbol='bits'), precision=AutoPrecision(digits=2))
- class View(*, name, title)
Bases:
object- Parameters:
name (
str) – A unique nametitle (
Title) – A title
- entry_point_prefixes()
Return the types of plug-ins and their respective prefixes that can be discovered by Checkmk.
These types can be used to create plug-ins that can be discovered by Checkmk. To be discovered, the plug-in must be of one of the types returned by this function and its name must start with the corresponding prefix.
- Return type:
Mapping[type[Node],str]
Example:
>>> for plugin_type, prefix in entry_point_prefixes().items(): ... print(f'{prefix}... = {plugin_type.__name__}(...)') node_... = Node(...)