{"id":15009888,"url":"https://github.com/linuxfabrik/lib","last_synced_at":"2026-04-14T18:01:02.674Z","repository":{"id":41305326,"uuid":"464840254","full_name":"Linuxfabrik/lib","owner":"Linuxfabrik","description":"Python 3.6+ modules for Linuxfabrik projects: DB access, SQLite KVS caching, WinRM, SMB, shell execution, 15+ API integrations (Icinga2, Veeam, Nextcloud, ...). Available on PyPI.","archived":false,"fork":false,"pushed_at":"2026-04-07T18:53:19.000Z","size":2559,"stargazers_count":16,"open_issues_count":2,"forks_count":6,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-04-07T20:32:54.048Z","etag":null,"topics":["api-client","caching","devops","icinga","icinga2","linuxfabrik","monitoring","monitoring-plugins","nagios","nagios-plugins","nextcloud","pypi","python","python-library","smb","sqlite","sysadmin","utility-library","veeam","winrm"],"latest_commit_sha":null,"homepage":"https://linuxfabrik.ch","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Linuxfabrik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"linuxfabrik"}},"created_at":"2022-03-01T10:08:51.000Z","updated_at":"2026-04-07T18:53:23.000Z","dependencies_parsed_at":"2023-09-29T10:37:27.482Z","dependency_job_id":"5095bd64-beb6-4694-8f97-8ab732cb70e4","html_url":"https://github.com/Linuxfabrik/lib","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/Linuxfabrik/lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linuxfabrik%2Flib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linuxfabrik%2Flib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linuxfabrik%2Flib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linuxfabrik%2Flib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Linuxfabrik","download_url":"https://codeload.github.com/Linuxfabrik/lib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linuxfabrik%2Flib/sbom","scorecard":{"id":1245767,"data":{"date":"2026-04-02T15:31:23Z","repo":{"name":"github.com/Linuxfabrik/lib","commit":"07bfb906b59444203b513ebcd4244ac476d35937"},"scorecard":{"version":"v5.3.0","commit":"c22063e786c11f9dd714d777a687ff7c4599b600"},"score":6.6,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#dangerous-workflow"}},{"name":"Dependency-Update-Tool","score":10,"reason":"update tool detected","details":["Info: detected update tool: Dependabot: .github/dependabot.yml:1"],"documentation":{"short":"Determines if the project uses a dependency update tool.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#dependency-update-tool"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#maintained"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#security-policy"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/12 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:98: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/codeql.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/dependency-review.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/dependency-review.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/dependency-review.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/dependency-review.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/dependency-review.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/dependency-review.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/docs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/docs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/docs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/docs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pre-commit-autoupdate.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/pre-commit-autoupdate.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pre-commit-autoupdate.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/pre-commit-autoupdate.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pre-commit-autoupdate.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/pre-commit-autoupdate.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/scorecard.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/scorecard.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/scorecard.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/scorecard.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/scorecard.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/scorecard.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/scorecard.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/scorecard.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/scorecard.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/Linuxfabrik/lib/scorecard.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/docs.yml:31","Warn: pipCommand not pinned by hash: .github/workflows/docs.yml:32","Warn: pipCommand not pinned by hash: .github/workflows/pre-commit-autoupdate.yml:26","Warn: pipCommand not pinned by hash: .github/workflows/release.yml:26","Info:   0 out of  19 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 third-party GitHubAction dependencies pinned","Info:   0 out of   4 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:39","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:40","Info: jobLevel 'packages' permission set to 'read': .github/workflows/codeql.yml:36","Warn: no topLevel permission defined: .github/workflows/codeql.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/dependency-review.yml:7","Info: topLevel 'contents' permission set to 'read': .github/workflows/docs.yml:9","Warn: topLevel 'contents' permission set to 'write': .github/workflows/pre-commit-autoupdate.yml:9","Info: topLevel 'contents' permission set to 'read': .github/workflows/release.yml:9","Info: topLevel permissions set to 'read-all': .github/workflows/scorecard.yml:8","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#cii-best-practices"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: The Unlicense: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-gc5v-m9x4-r6x2"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#vulnerabilities"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#packaging"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#branch-protection"}},{"name":"SAST","score":10,"reason":"SAST tool is run on all commits","details":["Info: SAST configuration detected: CodeQL","Info: all commits (18) are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#sast"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#fuzzing"}},{"name":"Contributors","score":6,"reason":"project has 2 contributing companies or organizations -- score normalized to 6","details":["Info: found contributions from: Linuxfabrik, linuxfabrik"],"documentation":{"short":"Determines if the project has a set of contributors from multiple organizations (e.g., companies).","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#contributors"}},{"name":"CI-Tests","score":10,"reason":"9 out of 9 merged PRs checked by a CI test -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project runs tests before pull requests are merged.","url":"https://github.com/ossf/scorecard/blob/c22063e786c11f9dd714d777a687ff7c4599b600/docs/checks.md#ci-tests"}}]},"last_synced_at":"2026-04-07T20:36:26.430Z","repository_id":41305326,"created_at":"2026-04-07T20:36:26.430Z","updated_at":"2026-04-07T20:36:26.430Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31808518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T11:13:53.975Z","status":"ssl_error","status_checked_at":"2026-04-14T11:13:53.299Z","response_time":153,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","caching","devops","icinga","icinga2","linuxfabrik","monitoring","monitoring-plugins","nagios","nagios-plugins","nextcloud","pypi","python","python-library","smb","sqlite","sysadmin","utility-library","veeam","winrm"],"created_at":"2024-09-24T19:29:02.291Z","updated_at":"2026-04-14T18:01:02.668Z","avatar_url":"https://github.com/Linuxfabrik.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003e\n  Linuxfabrik Python Libraries\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  Python 3.9+ modules for Linuxfabrik projects: DB access, SQLite KVS caching, WinRM, SMB, shell execution, 15+ API integrations (Icinga2, Veeam, Nextcloud, ...). Available on PyPI.\n  \u003cspan\u003e\u0026#8226;\u003c/span\u003e\n  \u003cb\u003emade by \u003ca href=\"https://linuxfabrik.ch/\"\u003eLinuxfabrik\u003c/a\u003e\u003c/b\u003e\n\u003c/p\u003e\n\u003cdiv align=\"center\"\u003e\n\n![GitHub Stars](https://img.shields.io/github/stars/linuxfabrik/lib)\n![License](https://img.shields.io/github/license/linuxfabrik/lib)\n![Version](https://img.shields.io/github/v/release/linuxfabrik/lib?sort=semver)\n[![PyPI](https://img.shields.io/pypi/v/linuxfabrik-lib)](https://pypi.org/project/linuxfabrik-lib/)\n![Python](https://img.shields.io/badge/Python-3.9+-3776ab)\n![GitHub Issues](https://img.shields.io/github/issues/linuxfabrik/lib)\n[![GitHubSponsors](https://img.shields.io/github/sponsors/Linuxfabrik?label=GitHub%20Sponsors)](https://github.com/sponsors/Linuxfabrik)\n[![PayPal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=7AW3VVX62TR4A\u0026source=url)\n\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\n\n# Linuxfabrik Python Libraries\n\nA mature, production-grade Python library collection providing 35+ modules with 300+ functions for system administration, monitoring, and infrastructure automation. These libraries are used across several Linuxfabrik projects -- most prominently the [Linuxfabrik Monitoring Plugins](https://github.com/Linuxfabrik/monitoring-plugins) (Nagios/Icinga check plugins), but also in [ChecklistFabrik](https://github.com/Linuxfabrik/checklistfabrik) and other tools.\n\nThe library requires Python 3.9+ and runs on every platform.\n\n\n## Installation\n\nAdd `linuxfabrik-lib` as a dependency to your project, or install it manually:\n\n```bash\npip install --user linuxfabrik-lib\n```\n\n\n## Documentation\n\nFull API documentation is available at [linuxfabrik.github.io/lib](https://linuxfabrik.github.io/lib/). It is automatically built and deployed on every push to `main`.\n\n\n## Design Principles\n\nThese libraries are built with a clear set of priorities:\n\n* **Procedural by design.** The libraries deliberately use a procedural/functional style rather than object-oriented programming. Pure functions with explicit inputs and outputs are easier to read, test, and reason about. This is especially true for the most prominent use case -- monitoring plugins -- which are short-lived, linear processes with no complex state to manage over time, where unnecessary abstraction layers would add overhead without tangible benefit.\n* **Broad compatibility.** Python 3.9+ is the minimum, ensuring the libraries work on RHEL 8 and every major distribution without requiring newer runtimes.\n* **Cross-platform.** Core functions behave identically on Linux, Windows, and macOS. Platform-specific code (WinRM, PowerShell, SMB) is cleanly separated.\n* **Minimal dependencies.** We avoid pulling in large dependency trees. External packages are used only when the alternative would be unreliable or significantly more complex.\n* **Consistent error handling.** Most functions return `(success, result)` tuples. The caller decides whether to continue or exit -- the library never exits on its own. The `base.coe()` (\"Continue or Exit\") helper makes this pattern concise.\n* **Automatic redaction.** Sensitive data (passwords, tokens, API keys) in error messages is automatically sanitized before output.\n* **Nagios/Icinga conventions.** State constants, threshold evaluation, performance data formatting, and range parsing follow the [Monitoring Plugins Development Guidelines](https://www.monitoring-plugins.org/doc/guidelines.html).\n* **Defensive defaults.** Functions use sensible timeouts, safe SSL settings, and locked-down defaults so that plugins work out of the box without extensive configuration.\n\n\n## Library Index\n\n\n### Core Utilities\n\n| Module | Description | Key Functions |\n|--------|-------------|---------------|\n| **args.py** | Extends `argparse` with custom input types for monitoring thresholds and common parameters. | `csv()`, `float_or_none()`, `int_or_none()`, `number_unit_method()` |\n| **base.py** | The central library for plugin development. Provides state evaluation, threshold comparison, performance data formatting, ASCII table output, and the `coe()` error-handling pattern. | `coe()`, `get_perfdata()`, `get_state()`, `get_table()`, `get_worst()`, `match_range()`, `oao()`, `state2str()` |\n| **globals.py** | Defines the four Nagios/Icinga plugin states: `STATE_OK` (0), `STATE_WARN` (1), `STATE_CRIT` (2), `STATE_UNKNOWN` (3). | -- |\n| **human.py** | Converts raw numbers and durations to human-readable representations and back. Supports binary/SI prefixes and Nagios range syntax with units. | `bytes2human()`, `human2bytes()`, `seconds2human()`, `human2seconds()`, `number2human()` |\n| **lftest.py** | Test harness for running plugin unit tests against expected STDOUT/STDERR output files. | `test()` |\n| **time.py** | Date/time conversions between UNIX epochs, ISO strings, datetime objects, and weekday names. Timezone-aware. | `epoch2iso()`, `now()`, `timestr2epoch()`, `timestrdiff()`, `utc_offset()` |\n| **txt.py** | Text processing: encoding conversion, regex compilation, substring extraction, multi-line parsing, sensitive data redaction, and pluralization. | `sanitize_sensitive_data()`, `extract_str()`, `mltext2array()`, `to_text()`, `to_bytes()` |\n| **version.py** | Software version parsing, comparison, and End-of-Life checking against [endoflife.date](https://endoflife.date). | `check_eol()`, `version()`, `version2float()` |\n\n\n### Data Access \u0026 Caching\n\n| Module | Description | Key Functions |\n|--------|-------------|---------------|\n| **cache.py** | A simple SQLite-based key-value store with optional key expiration. Used for persisting state between plugin runs. | `get()`, `set()` |\n| **db_mysql.py** | MySQL/MariaDB client with connection management, query execution, and privilege checking. | `connect()`, `select()`, `check_select_privileges()` |\n| **db_sqlite.py** | Full SQLite interface: table/index creation, CRUD operations, CSV import, regex support, and automatic load computation for time-series data. | `connect()`, `select()`, `insert()`, `create_table()`, `compute_load()`, `import_csv()` |\n\n\n### System \u0026 OS\n\n| Module | Description | Key Functions |\n|--------|-------------|---------------|\n| **disk.py** | File I/O, directory walking, CSV/environment file parsing, partition listing, device-mapper resolution, and file ownership lookup. | `read_file()`, `walk_directory()`, `grep_file()`, `read_csv()`, `get_real_disks()` |\n| **distro.py** | Linux distribution detection. Returns normalized facts including distribution name, version, and Ansible-compatible `os_family`. | `get_distribution_facts()` |\n| **dmidecode.py** | Parses `dmidecode` output into structured data. Extracts CPU, RAM, firmware, serial number, manufacturer, and model information. | `get_data()`, `cpu_type()`, `ram()`, `manufacturer()`, `model()`, `serno()` |\n| **endoflifedate.py** | Bundled End-of-Life data from [endoflife.date](https://endoflife.date) for offline version checks when internet access is unavailable. | -- |\n| **psutil.py** | Wrapper around `psutil` for retrieving mounted disk partitions with device, mount point, and filesystem type. | `get_partitions()` |\n| **shell.py** | Subprocess execution with pipeline support, regex filtering, configurable locale, and timeout handling. Works on Linux and Windows. | `shell_exec()`, `get_command_output()` |\n\n\n### Networking \u0026 HTTP\n\n| Module | Description | Key Functions |\n|--------|-------------|---------------|\n| **feedparser.py** | Parses Atom and RSS feeds from URLs using BeautifulSoup. | `parse()` |\n| **net.py** | Low-level networking: TCP/UDP sockets, SSL connections, Unix domain sockets, public IP lookup, hostname validation, and CIDR conversion. | `fetch()`, `fetch_ssl()`, `fetch_socket()`, `get_public_ip()`, `is_valid_hostname()` |\n| **url.py** | HTTP client for fetching HTML, JSON, or raw data. Supports GET/POST, Basic/Digest authentication, SSL/TLS options, custom headers, and proxy control. | `fetch()`, `fetch_json()`, `get_latest_version_from_github()`, `strip_tags()` |\n\n\n### Windows Integration\n\n| Module | Description | Key Functions |\n|--------|-------------|---------------|\n| **powershell.py** | Executes PowerShell commands locally (on Windows hosts). | `run_ps()` |\n| **smb.py** | Native SMB/CIFS file access: list, glob, and open files on remote shares with encryption support. | `glob()`, `open_file()` |\n| **winrm.py** | Executes commands and PowerShell scripts on remote Windows hosts via WinRM. Supports Kerberos, NTLM, CredSSP, and JEA (Just Enough Administration). | `run_cmd()`, `run_ps()` |\n\n\n### API Integrations\n\n| Module | Description | Key Functions |\n|--------|-------------|---------------|\n| **grassfish.py** | [Grassfish](https://www.grassfish.com/) digital signage REST API. | `fetch_json()` |\n| **huawei.py** | Huawei storage system status parsing (controller models, health, LED status). | `get_controller_model()` |\n| **icinga.py** | Icinga2 REST API client for querying services, setting acknowledgements, and managing downtimes. | `get_service()`, `set_ack()`, `set_downtime()`, `remove_downtime()` |\n| **infomaniak.py** | [Infomaniak](https://www.infomaniak.com/) Swiss Backup REST API for events and backup products. | `get_events()`, `get_swiss_backup_products()` |\n| **jitsi.py** | [Jitsi Meet](https://jitsi.org/) server statistics API. | `get_data()` |\n| **keycloak.py** | [Keycloak](https://www.keycloak.org/) identity provider API with OIDC discovery and admin token management. | `discover_oidc_endpoints()`, `obtain_admin_token()`, `get_data()` |\n| **librenms.py** | [LibreNMS](https://www.librenms.org/) monitoring API with state conversion. | `get_data()` |\n| **nextcloud.py** | [Nextcloud](https://nextcloud.com/) OCC command execution. | `run_occ()` |\n| **nodebb.py** | [NodeBB](https://nodebb.org/) forum API. | `get_data()` |\n| **qts.py** | [QNAP QTS](https://www.qnap.com/) NAS API with authentication. | `get_auth_sid()` |\n| **redfish.py** | [Redfish](https://www.dmtf.org/standards/redfish) BMC API for chassis, thermal, power, and storage monitoring. | `get_chassis()`, `get_thermal()`, `get_power()` |\n| **rocket.py** | [Rocket.Chat](https://www.rocket.chat/) API for statistics, room management, and webhooks. | `get_token()`, `get_stats()`, `send2webhook()` |\n| **uptimerobot.py** | [UptimeRobot](https://uptimerobot.com/) API for monitor and alert management. | `get_monitors()`, `new_monitor()`, `get_account_details()` |\n| **veeam.py** | [Veeam](https://www.veeam.com/) Backup \u0026 Replication Enterprise Manager API. | `get_token()` |\n| **wildfly.py** | [WildFly/JBoss](https://www.wildfly.org/) application server management API (standalone and domain mode). | `get_data()` |\n\n\n## Usage Example\n\nA typical monitoring plugin using these libraries:\n\n```python\nimport lib.args\nimport lib.base\nimport lib.url\nfrom lib.globals import (STATE_CRIT, STATE_OK, STATE_UNKNOWN, STATE_WARN)\n\ndef main():\n    # Parse arguments with custom threshold types\n    parser = lib.args.ArgumentParser()\n    parser.add_argument('--url', required=True)\n    parser.add_argument('--warning', type=lib.args.float_or_none, default=80)\n    parser.add_argument('--critical', type=lib.args.float_or_none, default=90)\n    args = parser.parse_args()\n\n    # Fetch data (coe = \"Continue or Exit\")\n    result = lib.base.coe(lib.url.fetch_json(args.url))\n\n    # Evaluate thresholds\n    state = lib.base.get_state(result['usage'], args.warning, args.critical)\n    perfdata = lib.base.get_perfdata('usage', result['usage'], '%', args.warning, args.critical, 0, 100)\n\n    # Output and exit\n    lib.base.oao('Usage is {}%'.format(result['usage']), state, perfdata)\n\nif __name__ == '__main__':\n    main()\n```\n\n\n## Tips \u0026 Tricks\n\nCount the function calls to any \"lib\" library in your project and sort by frequency:\n\n```bash\ngrep -rhoP '\\Wlib\\.[a-zA-Z0-9_\\.]+' * | sed 's/^[^a-zA-Z0-9]*//' | sort | uniq -c | sort -nr\n```\n","funding_links":["https://github.com/sponsors/linuxfabrik","https://github.com/sponsors/Linuxfabrik","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=7AW3VVX62TR4A\u0026source=url"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxfabrik%2Flib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinuxfabrik%2Flib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxfabrik%2Flib/lists"}