You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case the API object or method name matches one of Python keywords, you can use the suffix `_` in their name to execute correctly:
136
+
In case the API object or method name matches one of Python keywords, you can use the suffix `_` in their name to execute correctly, for example:
119
137
```python
120
138
from zabbix_utils import ZabbixAPI
121
139
@@ -136,7 +154,7 @@ if response:
136
154
print("Template imported successfully")
137
155
```
138
156
139
-
> Please, refer to the [Zabbix API Documentation](https://www.zabbix.com/documentation/current/manual/api/reference) and the [using examples](https://github.com/zabbix/python-zabbix-utils/tree/main/examples/api/synchronous) for more information.
157
+
> Please, refer to the [Zabbix API Documentation](https://www.zabbix.com/documentation/current/manual/api/reference) and the [using examples](https://github.com/zabbix/python-zabbix-utils/tree/main/examples/api) for more information.
You can also prepare a list of item values and send all at once:
156
190
157
191
```python
158
192
from zabbix_utils import ItemValue, Sender
@@ -197,11 +231,11 @@ print(response.details)
197
231
198
232
In such case, the value will be sent to the first available node of each cluster.
199
233
200
-
> Please, refer to the [Zabbix sender protocol](https://www.zabbix.com/documentation/current/manual/appendix/protocols/zabbix_sender) and the [using examples](https://github.com/zabbix/python-zabbix-utils/tree/main/examples/sender/synchronous) for more information.
234
+
> Please, refer to the [Zabbix sender protocol](https://www.zabbix.com/documentation/current/manual/appendix/protocols/zabbix_sender) and the [using examples](https://github.com/zabbix/python-zabbix-utils/tree/main/examples/sender) for more information.
201
235
202
236
##### To work via Zabbix get protocol
203
237
204
-
To get a value by item key from a Zabbix agent or agent 2 you can import and use the library as follows:
238
+
To get a value by item key from a Zabbix agent or agent 2 via synchronous I/O the library can be imported and used as follows:
205
239
206
240
```python
207
241
from zabbix_utils import Getter
@@ -213,7 +247,23 @@ print(resp.value)
213
247
# Linux test_server 5.15.0-3.60.5.1.el9uek.x86_64
214
248
```
215
249
216
-
> Please, refer to the [Zabbix agent protocol](https://www.zabbix.com/documentation/current/manual/appendix/protocols/zabbix_agent) and the [using examples](https://github.com/zabbix/python-zabbix-utils/tree/main/examples/get/synchronous) for more information.
250
+
The library can be used via asynchronous I/O, as in the following example:
251
+
252
+
```python
253
+
import asyncio
254
+
from zabbix_utils import AsyncGetter
255
+
256
+
asyncdefmain():
257
+
agent = AsyncGetter(host='127.0.0.1', port=10050)
258
+
resp =await agent.get('system.uname')
259
+
260
+
print(resp.value)
261
+
# Linux test_server 5.15.0-3.60.5.1.el9uek.x86_64
262
+
263
+
asyncio.run(main())
264
+
```
265
+
266
+
> Please, refer to the [Zabbix agent protocol](https://www.zabbix.com/documentation/current/manual/appendix/protocols/zabbix_agent) and the [using examples](https://github.com/zabbix/python-zabbix-utils/tree/main/examples/get) for more information.
0 commit comments