nz-sdk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. nz_sdk-0.1.0/PKG-INFO +149 -0
  2. nz_sdk-0.1.0/README.md +107 -0
  3. nz_sdk-0.1.0/pyproject.toml +108 -0
  4. nz_sdk-0.1.0/setup.cfg +4 -0
  5. nz_sdk-0.1.0/src/nz_sdk/__init__.py +98 -0
  6. nz_sdk-0.1.0/src/nz_sdk/__main__.py +8 -0
  7. nz_sdk-0.1.0/src/nz_sdk/_proto/__init__.py +5 -0
  8. nz_sdk-0.1.0/src/nz_sdk/_proto/nezha_pb2.py +59 -0
  9. nz_sdk-0.1.0/src/nz_sdk/_proto/nezha_pb2.pyi +153 -0
  10. nz_sdk-0.1.0/src/nz_sdk/_proto/nezha_pb2_grpc.py +312 -0
  11. nz_sdk-0.1.0/src/nz_sdk/_x509.py +204 -0
  12. nz_sdk-0.1.0/src/nz_sdk/agent.py +632 -0
  13. nz_sdk-0.1.0/src/nz_sdk/cli.py +276 -0
  14. nz_sdk-0.1.0/src/nz_sdk/client.py +336 -0
  15. nz_sdk-0.1.0/src/nz_sdk/config.py +549 -0
  16. nz_sdk-0.1.0/src/nz_sdk/metrics/__init__.py +49 -0
  17. nz_sdk-0.1.0/src/nz_sdk/metrics/circuit_breaker.py +37 -0
  18. nz_sdk-0.1.0/src/nz_sdk/metrics/collector.py +440 -0
  19. nz_sdk-0.1.0/src/nz_sdk/metrics/disk.py +114 -0
  20. nz_sdk-0.1.0/src/nz_sdk/metrics/geoip.py +188 -0
  21. nz_sdk-0.1.0/src/nz_sdk/metrics/gpu.py +251 -0
  22. nz_sdk-0.1.0/src/nz_sdk/metrics/nic.py +105 -0
  23. nz_sdk-0.1.0/src/nz_sdk/py.typed +0 -0
  24. nz_sdk-0.1.0/src/nz_sdk/tasks/__init__.py +180 -0
  25. nz_sdk-0.1.0/src/nz_sdk/tasks/command.py +135 -0
  26. nz_sdk-0.1.0/src/nz_sdk/tasks/config_ops.py +226 -0
  27. nz_sdk-0.1.0/src/nz_sdk/tasks/iostream/__init__.py +94 -0
  28. nz_sdk-0.1.0/src/nz_sdk/tasks/iostream/fm.py +345 -0
  29. nz_sdk-0.1.0/src/nz_sdk/tasks/iostream/framing.py +182 -0
  30. nz_sdk-0.1.0/src/nz_sdk/tasks/iostream/fs_transfer.py +394 -0
  31. nz_sdk-0.1.0/src/nz_sdk/tasks/iostream/nat.py +203 -0
  32. nz_sdk-0.1.0/src/nz_sdk/tasks/iostream/terminal.py +303 -0
  33. nz_sdk-0.1.0/src/nz_sdk/tasks/mcp.py +867 -0
  34. nz_sdk-0.1.0/src/nz_sdk/tasks/probes.py +355 -0
  35. nz_sdk-0.1.0/src/nz_sdk/types.py +180 -0
  36. nz_sdk-0.1.0/src/nz_sdk.egg-info/PKG-INFO +149 -0
  37. nz_sdk-0.1.0/src/nz_sdk.egg-info/SOURCES.txt +46 -0
  38. nz_sdk-0.1.0/src/nz_sdk.egg-info/dependency_links.txt +1 -0
  39. nz_sdk-0.1.0/src/nz_sdk.egg-info/entry_points.txt +2 -0
  40. nz_sdk-0.1.0/src/nz_sdk.egg-info/requires.txt +17 -0
  41. nz_sdk-0.1.0/src/nz_sdk.egg-info/top_level.txt +1 -0
  42. nz_sdk-0.1.0/tests/test_agent_integration.py +402 -0
  43. nz_sdk-0.1.0/tests/test_config.py +174 -0
  44. nz_sdk-0.1.0/tests/test_iostream_framing.py +378 -0
  45. nz_sdk-0.1.0/tests/test_metrics.py +266 -0
  46. nz_sdk-0.1.0/tests/test_tasks_config.py +164 -0
  47. nz_sdk-0.1.0/tests/test_tasks_mcp.py +246 -0
  48. nz_sdk-0.1.0/tests/test_tasks_probes_cmd.py +224 -0
nz_sdk-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: nz-sdk
3
+ Version: 0.1.0
4
+ Summary: Wire-compatible native Python SDK and drop-in CLI agent for Nezha Monitoring (nezhahq/nezha)
5
+ Author: kaecho
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/kaecho/nz-sdk
8
+ Project-URL: Repository, https://github.com/kaecho/nz-sdk
9
+ Project-URL: Issues, https://github.com/kaecho/nz-sdk/issues
10
+ Project-URL: Documentation, https://github.com/kaecho/nz-sdk#readme
11
+ Keywords: nezha,nezha-agent,monitoring,grpc,telemetry,sdk
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: System :: Monitoring
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ Requires-Dist: grpcio>=1.85.4
27
+ Requires-Dist: protobuf>=7.35.1
28
+ Requires-Dist: psutil>=5.9.0
29
+ Requires-Dist: PyYAML>=6.0
30
+ Requires-Dist: httpx>=0.27.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
33
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == "dev"
34
+ Requires-Dist: ruff>=0.6.0; extra == "dev"
35
+ Requires-Dist: mypy>=1.10.0; extra == "dev"
36
+ Requires-Dist: build>=1.2.0; extra == "dev"
37
+ Requires-Dist: twine>=5.0.0; extra == "dev"
38
+ Requires-Dist: grpcio-tools>=1.60.0; extra == "dev"
39
+ Requires-Dist: cryptography>=42.0.0; extra == "dev"
40
+ Requires-Dist: types-PyYAML>=6.0.12; extra == "dev"
41
+ Requires-Dist: types-psutil>=5.9.5; extra == "dev"
42
+
43
+ # nz-sdk (Python)
44
+
45
+ Wire-compatible native Python SDK and drop-in CLI implementation of [`nezhahq/agent`](https://github.com/nezhahq/agent) for [Nezha Monitoring](https://github.com/nezhahq/nezha).
46
+
47
+ - **Full gRPC protocol parity** across all 6 `proto.NezhaService` RPCs (`ReportSystemInfo2`, `ReportSystemInfo`, `ReportSystemState`, `RequestTask`, `IOStream`, `ReportGeoIP`)
48
+ - **All 20 `TaskType`s**: HTTP/ICMP/TCP probes, shell commands, remote config reload & server transfer, MCP RPCs (`Exec`, `FsList`, `FsRead`, `FsWrite`, `FsDelete`, `FsTransfer`), and `IOStream` sub-protocols (`TerminalGRPC`, `NAT`, File Manager v1+v2)
49
+ - **Async-first SDK** (`asyncio` + `grpc.aio`) with a thread-backed synchronous wrapper (`SyncNezhaAgent`), custom collector hooks, task handler overrides, and lifecycle callbacks
50
+ - **Drop-in CLI** (`nz-agent` / `python -m nz_sdk`) compatible with `config.yml` and `NZ_*` environment variables
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ pip install nz-sdk
56
+ ```
57
+
58
+ ## Quickstart (Async SDK)
59
+
60
+ ```python
61
+ import asyncio
62
+ from nz_sdk import AgentConfig, NezhaAgent
63
+
64
+
65
+ async def main() -> None:
66
+ config = AgentConfig(
67
+ server="dashboard.example.com:443",
68
+ client_secret="your-agent-secret",
69
+ tls=True,
70
+ )
71
+ async with NezhaAgent(
72
+ config,
73
+ on_connected=lambda boot_time: print(f"Connected! Dashboard boot: {boot_time}"),
74
+ on_state_reported=lambda state: print(f"CPU: {state.cpu:.1f}%"),
75
+ ) as agent:
76
+ await asyncio.sleep(60)
77
+
78
+
79
+ asyncio.run(main())
80
+ ```
81
+
82
+ ## Quickstart (Synchronous / Blocking)
83
+
84
+ ```python
85
+ from nz_sdk import AgentConfig, NezhaAgent
86
+
87
+ config = AgentConfig.from_yaml("config.yml")
88
+ agent = NezhaAgent(config)
89
+ agent.run_sync()
90
+ ```
91
+
92
+ Or run in a background thread via `SyncNezhaAgent`:
93
+
94
+ ```python
95
+ from nz_sdk import AgentConfig, SyncNezhaAgent
96
+
97
+ with SyncNezhaAgent(AgentConfig.from_env()) as agent:
98
+ ...
99
+ ```
100
+
101
+ ## Custom Collector & Task Hooks
102
+
103
+ ```python
104
+ from nz_sdk import (
105
+ AgentConfig,
106
+ HostInfo,
107
+ HostState,
108
+ NezhaAgent,
109
+ PsutilCollector,
110
+ TaskRequest,
111
+ TaskResponse,
112
+ TaskType,
113
+ )
114
+
115
+
116
+ class CustomCollector(PsutilCollector):
117
+ async def collect_host(self, config: AgentConfig) -> HostInfo:
118
+ info = await super().collect_host(config)
119
+ info.platform = "custom-embedded-linux"
120
+ return info
121
+
122
+
123
+ async def handle_upgrade(task: TaskRequest) -> TaskResponse:
124
+ return TaskResponse(id=task.id, type=task.type, successful=True, data="handled")
125
+
126
+
127
+ agent = NezhaAgent(
128
+ AgentConfig(server="127.0.0.1:8008", client_secret="secret"),
129
+ collector=CustomCollector(),
130
+ task_handlers={TaskType.UPGRADE: handle_upgrade},
131
+ )
132
+ ```
133
+
134
+ ## CLI Usage
135
+
136
+ ```bash
137
+ # Load from config.yml (with NZ_* env var overrides)
138
+ nz-agent -c /etc/nezha/config.yml
139
+
140
+ # Or configure purely via flags / environment variables
141
+ nz-agent --server dashboard.example.com:443 --secret YOUR_SECRET --tls
142
+
143
+ # Equivalent module invocation
144
+ python -m nz_sdk --server 127.0.0.1:8008 --secret YOUR_SECRET
145
+ ```
146
+
147
+ ## License
148
+
149
+ MIT License. See the repository root `LICENSE` for details and upstream attributions (`nezhahq/agent` WTFPL v2, Telegraf GPU parsers MIT).
nz_sdk-0.1.0/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # nz-sdk (Python)
2
+
3
+ Wire-compatible native Python SDK and drop-in CLI implementation of [`nezhahq/agent`](https://github.com/nezhahq/agent) for [Nezha Monitoring](https://github.com/nezhahq/nezha).
4
+
5
+ - **Full gRPC protocol parity** across all 6 `proto.NezhaService` RPCs (`ReportSystemInfo2`, `ReportSystemInfo`, `ReportSystemState`, `RequestTask`, `IOStream`, `ReportGeoIP`)
6
+ - **All 20 `TaskType`s**: HTTP/ICMP/TCP probes, shell commands, remote config reload & server transfer, MCP RPCs (`Exec`, `FsList`, `FsRead`, `FsWrite`, `FsDelete`, `FsTransfer`), and `IOStream` sub-protocols (`TerminalGRPC`, `NAT`, File Manager v1+v2)
7
+ - **Async-first SDK** (`asyncio` + `grpc.aio`) with a thread-backed synchronous wrapper (`SyncNezhaAgent`), custom collector hooks, task handler overrides, and lifecycle callbacks
8
+ - **Drop-in CLI** (`nz-agent` / `python -m nz_sdk`) compatible with `config.yml` and `NZ_*` environment variables
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install nz-sdk
14
+ ```
15
+
16
+ ## Quickstart (Async SDK)
17
+
18
+ ```python
19
+ import asyncio
20
+ from nz_sdk import AgentConfig, NezhaAgent
21
+
22
+
23
+ async def main() -> None:
24
+ config = AgentConfig(
25
+ server="dashboard.example.com:443",
26
+ client_secret="your-agent-secret",
27
+ tls=True,
28
+ )
29
+ async with NezhaAgent(
30
+ config,
31
+ on_connected=lambda boot_time: print(f"Connected! Dashboard boot: {boot_time}"),
32
+ on_state_reported=lambda state: print(f"CPU: {state.cpu:.1f}%"),
33
+ ) as agent:
34
+ await asyncio.sleep(60)
35
+
36
+
37
+ asyncio.run(main())
38
+ ```
39
+
40
+ ## Quickstart (Synchronous / Blocking)
41
+
42
+ ```python
43
+ from nz_sdk import AgentConfig, NezhaAgent
44
+
45
+ config = AgentConfig.from_yaml("config.yml")
46
+ agent = NezhaAgent(config)
47
+ agent.run_sync()
48
+ ```
49
+
50
+ Or run in a background thread via `SyncNezhaAgent`:
51
+
52
+ ```python
53
+ from nz_sdk import AgentConfig, SyncNezhaAgent
54
+
55
+ with SyncNezhaAgent(AgentConfig.from_env()) as agent:
56
+ ...
57
+ ```
58
+
59
+ ## Custom Collector & Task Hooks
60
+
61
+ ```python
62
+ from nz_sdk import (
63
+ AgentConfig,
64
+ HostInfo,
65
+ HostState,
66
+ NezhaAgent,
67
+ PsutilCollector,
68
+ TaskRequest,
69
+ TaskResponse,
70
+ TaskType,
71
+ )
72
+
73
+
74
+ class CustomCollector(PsutilCollector):
75
+ async def collect_host(self, config: AgentConfig) -> HostInfo:
76
+ info = await super().collect_host(config)
77
+ info.platform = "custom-embedded-linux"
78
+ return info
79
+
80
+
81
+ async def handle_upgrade(task: TaskRequest) -> TaskResponse:
82
+ return TaskResponse(id=task.id, type=task.type, successful=True, data="handled")
83
+
84
+
85
+ agent = NezhaAgent(
86
+ AgentConfig(server="127.0.0.1:8008", client_secret="secret"),
87
+ collector=CustomCollector(),
88
+ task_handlers={TaskType.UPGRADE: handle_upgrade},
89
+ )
90
+ ```
91
+
92
+ ## CLI Usage
93
+
94
+ ```bash
95
+ # Load from config.yml (with NZ_* env var overrides)
96
+ nz-agent -c /etc/nezha/config.yml
97
+
98
+ # Or configure purely via flags / environment variables
99
+ nz-agent --server dashboard.example.com:443 --secret YOUR_SECRET --tls
100
+
101
+ # Equivalent module invocation
102
+ python -m nz_sdk --server 127.0.0.1:8008 --secret YOUR_SECRET
103
+ ```
104
+
105
+ ## License
106
+
107
+ MIT License. See the repository root `LICENSE` for details and upstream attributions (`nezhahq/agent` WTFPL v2, Telegraf GPU parsers MIT).
@@ -0,0 +1,108 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "nz-sdk"
7
+ version = "0.1.0"
8
+ description = "Wire-compatible native Python SDK and drop-in CLI agent for Nezha Monitoring (nezhahq/nezha)"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "kaecho" },
14
+ ]
15
+ keywords = [
16
+ "nezha",
17
+ "nezha-agent",
18
+ "monitoring",
19
+ "grpc",
20
+ "telemetry",
21
+ "sdk",
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 4 - Beta",
25
+ "Intended Audience :: Developers",
26
+ "Intended Audience :: System Administrators",
27
+ "Operating System :: OS Independent",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ "Programming Language :: Python :: 3.14",
34
+ "Topic :: System :: Monitoring",
35
+ "Typing :: Typed",
36
+ ]
37
+ dependencies = [
38
+ "grpcio>=1.85.4",
39
+ "protobuf>=7.35.1",
40
+ "psutil>=5.9.0",
41
+ "PyYAML>=6.0",
42
+ "httpx>=0.27.0",
43
+ ]
44
+
45
+ [project.optional-dependencies]
46
+ dev = [
47
+ "pytest>=8.0.0",
48
+ "pytest-asyncio>=0.24.0",
49
+ "ruff>=0.6.0",
50
+ "mypy>=1.10.0",
51
+ "build>=1.2.0",
52
+ "twine>=5.0.0",
53
+ "grpcio-tools>=1.60.0",
54
+ "cryptography>=42.0.0",
55
+ "types-PyYAML>=6.0.12",
56
+ "types-psutil>=5.9.5",
57
+ ]
58
+
59
+ [project.scripts]
60
+ nz-agent = "nz_sdk.cli:main"
61
+
62
+ [project.urls]
63
+ Homepage = "https://github.com/kaecho/nz-sdk"
64
+ Repository = "https://github.com/kaecho/nz-sdk"
65
+ Issues = "https://github.com/kaecho/nz-sdk/issues"
66
+ Documentation = "https://github.com/kaecho/nz-sdk#readme"
67
+
68
+ [tool.setuptools]
69
+ package-dir = { "" = "src" }
70
+
71
+ [tool.setuptools.packages.find]
72
+ where = ["src"]
73
+
74
+ [tool.setuptools.package-data]
75
+ nz_sdk = ["py.typed", "_proto/*.pyi"]
76
+
77
+ [tool.pytest.ini_options]
78
+ testpaths = ["tests"]
79
+ asyncio_mode = "auto"
80
+ asyncio_default_fixture_loop_scope = "function"
81
+
82
+ [tool.ruff]
83
+ target-version = "py310"
84
+ line-length = 100
85
+ src = ["src", "tests", "scripts"]
86
+ extend-exclude = ["src/nz_sdk/_proto/nezha_pb2*.py*"]
87
+
88
+ [tool.ruff.lint]
89
+ select = ["E", "F", "I", "UP", "B", "SIM", "W"]
90
+ ignore = ["E501", "SIM105"]
91
+
92
+ [tool.mypy]
93
+ python_version = "3.10"
94
+ warn_unused_configs = true
95
+ disallow_untyped_defs = true
96
+ check_untyped_defs = true
97
+ no_implicit_optional = true
98
+ warn_redundant_casts = true
99
+ warn_unused_ignores = true
100
+ exclude = ["src/nz_sdk/_proto/nezha_pb2.*"]
101
+
102
+ [[tool.mypy.overrides]]
103
+ module = [
104
+ "grpc",
105
+ "grpc.*",
106
+ "nz_sdk._proto.*",
107
+ ]
108
+ ignore_missing_imports = true
nz_sdk-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,98 @@
1
+ """nz-sdk: Wire-compatible native Python SDK and drop-in CLI for Nezha Monitoring."""
2
+
3
+ from __future__ import annotations
4
+
5
+ __version__ = "0.1.0"
6
+
7
+ from .agent import NezhaAgent, SyncNezhaAgent
8
+ from .client import NezhaClient, build_auth_metadata
9
+ from .config import (
10
+ UPSTREAM_CONFIG_KEYS,
11
+ AgentConfig,
12
+ ConfigValidationError,
13
+ generate_uuid,
14
+ is_valid_transfer_secret,
15
+ is_valid_uuid,
16
+ load_config,
17
+ save_config,
18
+ )
19
+ from .metrics import PsutilCollector
20
+ from .types import (
21
+ GeoIPInfo,
22
+ GPUStat,
23
+ HostInfo,
24
+ HostState,
25
+ SensorTemperature,
26
+ SystemCollector,
27
+ TaskHandler,
28
+ TaskRequest,
29
+ TaskResponse,
30
+ TaskType,
31
+ TaskTypeApplyConfig,
32
+ TaskTypeCommand,
33
+ TaskTypeExec,
34
+ TaskTypeFM,
35
+ TaskTypeFsDelete,
36
+ TaskTypeFsList,
37
+ TaskTypeFsRead,
38
+ TaskTypeFsTransfer,
39
+ TaskTypeFsWrite,
40
+ TaskTypeHTTPGet,
41
+ TaskTypeICMPPing,
42
+ TaskTypeKeepalive,
43
+ TaskTypeNAT,
44
+ TaskTypeReportConfig,
45
+ TaskTypeReportHostInfoDeprecated,
46
+ TaskTypeServerTransferApply,
47
+ TaskTypeTCPPing,
48
+ TaskTypeTerminal,
49
+ TaskTypeTerminalGRPC,
50
+ TaskTypeUpgrade,
51
+ )
52
+
53
+ __all__ = [
54
+ "__version__",
55
+ "AgentConfig",
56
+ "ConfigValidationError",
57
+ "GPUStat",
58
+ "GeoIPInfo",
59
+ "HostInfo",
60
+ "HostState",
61
+ "NezhaAgent",
62
+ "NezhaClient",
63
+ "PsutilCollector",
64
+ "SensorTemperature",
65
+ "SyncNezhaAgent",
66
+ "SystemCollector",
67
+ "TaskHandler",
68
+ "TaskRequest",
69
+ "TaskResponse",
70
+ "TaskType",
71
+ "TaskTypeApplyConfig",
72
+ "TaskTypeCommand",
73
+ "TaskTypeExec",
74
+ "TaskTypeFM",
75
+ "TaskTypeFsDelete",
76
+ "TaskTypeFsList",
77
+ "TaskTypeFsRead",
78
+ "TaskTypeFsTransfer",
79
+ "TaskTypeFsWrite",
80
+ "TaskTypeHTTPGet",
81
+ "TaskTypeICMPPing",
82
+ "TaskTypeKeepalive",
83
+ "TaskTypeNAT",
84
+ "TaskTypeReportConfig",
85
+ "TaskTypeReportHostInfoDeprecated",
86
+ "TaskTypeServerTransferApply",
87
+ "TaskTypeTCPPing",
88
+ "TaskTypeTerminal",
89
+ "TaskTypeTerminalGRPC",
90
+ "TaskTypeUpgrade",
91
+ "UPSTREAM_CONFIG_KEYS",
92
+ "build_auth_metadata",
93
+ "generate_uuid",
94
+ "is_valid_transfer_secret",
95
+ "is_valid_uuid",
96
+ "load_config",
97
+ "save_config",
98
+ ]
@@ -0,0 +1,8 @@
1
+ """Module entrypoint for ``python -m nz_sdk``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .cli import main
6
+
7
+ if __name__ == "__main__":
8
+ raise SystemExit(main())
@@ -0,0 +1,5 @@
1
+ """Generated protobuf and gRPC stubs for proto/nezha.proto."""
2
+
3
+ from . import nezha_pb2, nezha_pb2_grpc
4
+
5
+ __all__ = ["nezha_pb2", "nezha_pb2_grpc"]
@@ -0,0 +1,59 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: nezha.proto
5
+ # Protobuf Python Version: 7.35.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 7,
15
+ 35,
16
+ 1,
17
+ '',
18
+ 'nezha.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+
26
+
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0bnezha.proto\x12\x05proto\"\xd1\x01\n\x04Host\x12\x10\n\x08platform\x18\x01 \x01(\t\x12\x18\n\x10platform_version\x18\x02 \x01(\t\x12\x0b\n\x03\x63pu\x18\x03 \x03(\t\x12\x11\n\tmem_total\x18\x04 \x01(\x04\x12\x12\n\ndisk_total\x18\x05 \x01(\x04\x12\x12\n\nswap_total\x18\x06 \x01(\x04\x12\x0c\n\x04\x61rch\x18\x07 \x01(\t\x12\x16\n\x0evirtualization\x18\x08 \x01(\t\x12\x11\n\tboot_time\x18\t \x01(\x04\x12\x0f\n\x07version\x18\n \x01(\t\x12\x0b\n\x03gpu\x18\x0b \x03(\t\"\x94\x03\n\x05State\x12\x0b\n\x03\x63pu\x18\x01 \x01(\x01\x12\x10\n\x08mem_used\x18\x02 \x01(\x04\x12\x11\n\tswap_used\x18\x03 \x01(\x04\x12\x11\n\tdisk_used\x18\x04 \x01(\x04\x12\x17\n\x0fnet_in_transfer\x18\x05 \x01(\x04\x12\x18\n\x10net_out_transfer\x18\x06 \x01(\x04\x12\x14\n\x0cnet_in_speed\x18\x07 \x01(\x04\x12\x15\n\rnet_out_speed\x18\x08 \x01(\x04\x12\x0e\n\x06uptime\x18\t \x01(\x04\x12\r\n\x05load1\x18\n \x01(\x01\x12\r\n\x05load5\x18\x0b \x01(\x01\x12\x0e\n\x06load15\x18\x0c \x01(\x01\x12\x16\n\x0etcp_conn_count\x18\r \x01(\x04\x12\x16\n\x0eudp_conn_count\x18\x0e \x01(\x04\x12\x15\n\rprocess_count\x18\x0f \x01(\x04\x12\x34\n\x0ctemperatures\x18\x10 \x03(\x0b\x32\x1e.proto.State_SensorTemperature\x12\x0b\n\x03gpu\x18\x11 \x03(\x01\x12\x1e\n\x04gpus\x18\x12 \x03(\x0b\x32\x10.proto.State_GPU\"K\n\tState_GPU\x12\x13\n\x0butilization\x18\x01 \x01(\x01\x12\x13\n\x0bmemory_used\x18\x02 \x01(\x04\x12\x14\n\x0cmemory_total\x18\x03 \x01(\x04\"<\n\x17State_SensorTemperature\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0btemperature\x18\x02 \x01(\x01\".\n\x04Task\x12\n\n\x02id\x18\x01 \x01(\x04\x12\x0c\n\x04type\x18\x02 \x01(\x04\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\t\"W\n\nTaskResult\x12\n\n\x02id\x18\x01 \x01(\x04\x12\x0c\n\x04type\x18\x02 \x01(\x04\x12\r\n\x05\x64\x65lay\x18\x03 \x01(\x02\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\t\x12\x12\n\nsuccessful\x18\x05 \x01(\x08\"\x19\n\x07Receipt\x12\x0e\n\x06proced\x18\x01 \x01(\x08\"\x1d\n\rUint64Receipt\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x04\"\x1c\n\x0cIOStreamData\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\"_\n\x05GeoIP\x12\x0c\n\x04use6\x18\x01 \x01(\x08\x12\x15\n\x02ip\x18\x02 \x01(\x0b\x32\t.proto.IP\x12\x14\n\x0c\x63ountry_code\x18\x03 \x01(\t\x12\x1b\n\x13\x64\x61shboard_boot_time\x18\x04 \x01(\x04\" \n\x02IP\x12\x0c\n\x04ipv4\x18\x01 \x01(\t\x12\x0c\n\x04ipv6\x18\x02 \x01(\t2\xd2\x02\n\x0cNezhaService\x12\x37\n\x11ReportSystemState\x12\x0c.proto.State\x1a\x0e.proto.Receipt\"\x00(\x01\x30\x01\x12\x31\n\x10ReportSystemInfo\x12\x0b.proto.Host\x1a\x0e.proto.Receipt\"\x00\x12\x33\n\x0bRequestTask\x12\x11.proto.TaskResult\x1a\x0b.proto.Task\"\x00(\x01\x30\x01\x12:\n\x08IOStream\x12\x13.proto.IOStreamData\x1a\x13.proto.IOStreamData\"\x00(\x01\x30\x01\x12+\n\x0bReportGeoIP\x12\x0c.proto.GeoIP\x1a\x0c.proto.GeoIP\"\x00\x12\x38\n\x11ReportSystemInfo2\x12\x0b.proto.Host\x1a\x14.proto.Uint64Receipt\"\x00\x42\tZ\x07./protob\x06proto3')
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'nezha_pb2', _globals)
32
+ if not _descriptor._USE_C_DESCRIPTORS:
33
+ _globals['DESCRIPTOR']._loaded_options = None
34
+ _globals['DESCRIPTOR']._serialized_options = b'Z\007./proto'
35
+ _globals['_HOST']._serialized_start=23
36
+ _globals['_HOST']._serialized_end=232
37
+ _globals['_STATE']._serialized_start=235
38
+ _globals['_STATE']._serialized_end=639
39
+ _globals['_STATE_GPU']._serialized_start=641
40
+ _globals['_STATE_GPU']._serialized_end=716
41
+ _globals['_STATE_SENSORTEMPERATURE']._serialized_start=718
42
+ _globals['_STATE_SENSORTEMPERATURE']._serialized_end=778
43
+ _globals['_TASK']._serialized_start=780
44
+ _globals['_TASK']._serialized_end=826
45
+ _globals['_TASKRESULT']._serialized_start=828
46
+ _globals['_TASKRESULT']._serialized_end=915
47
+ _globals['_RECEIPT']._serialized_start=917
48
+ _globals['_RECEIPT']._serialized_end=942
49
+ _globals['_UINT64RECEIPT']._serialized_start=944
50
+ _globals['_UINT64RECEIPT']._serialized_end=973
51
+ _globals['_IOSTREAMDATA']._serialized_start=975
52
+ _globals['_IOSTREAMDATA']._serialized_end=1003
53
+ _globals['_GEOIP']._serialized_start=1005
54
+ _globals['_GEOIP']._serialized_end=1100
55
+ _globals['_IP']._serialized_start=1102
56
+ _globals['_IP']._serialized_end=1134
57
+ _globals['_NEZHASERVICE']._serialized_start=1137
58
+ _globals['_NEZHASERVICE']._serialized_end=1475
59
+ # @@protoc_insertion_point(module_scope)