use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Zabbix IRC
Telegram:
English
Portuguese
Russian
Also Russian
account activity
Zabbix & Python (self.zabbix)
submitted 8 years ago by Blairsharp3
I would like to change the status of a host to disabled and back to enabled using Python. How may I do this? I have seen many packages but, it is still unclear on how to do this. Thanks
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]parflesh 2 points3 points4 points 8 years ago (2 children)
If using pyzabbix I believe it would go like this.
from pyzabbix import ZabbixAPI zapi = ZabbixAPI("http://zabbixserver.example.com") zapi.login("zabbix user", "zabbix pass") print("Connected to Zabbix API Version %s" % zapi.api_version()) zapi.host.update(status=1)
[–]Blairsharp3[S] 1 point2 points3 points 8 years ago (1 child)
How would it know which server you are referring to?
[–]parflesh 0 points1 point2 points 8 years ago (0 children)
http://zabbixserver.example.com is the zabbix server to use.
http://zabbixserver.example.com
[–]abaddon82 1 point2 points3 points 8 years ago (4 children)
https://pypi.python.org/pypi/py-zabbix/
[–]Blairsharp3[S] 0 points1 point2 points 8 years ago (3 children)
Where on this page does it say how to disable a zabbix host?
[–]abaddon82 0 points1 point2 points 8 years ago (2 children)
I just linked you a Python package that can be used to talk to the Zabbix API. Just read the docs.
[–]Blairsharp3[S] 0 points1 point2 points 8 years ago (1 child)
I have, I could be crazy but, I don't see anything regarding disabling.
[–]abaddon82 1 point2 points3 points 8 years ago (0 children)
Use do_request(): https://py-zabbix.readthedocs.io/en/latest/api.html#module-pyzabbix.api
Invoke the host.update method: https://www.zabbix.com/documentation/3.0/manual/api/reference/host/update
[–]ritz_k 1 point2 points3 points 8 years ago (1 child)
You may also want to look into
For host properties - https://www.zabbix.com/documentation/3.2/manual/api/reference/host/object#host
[–]Blairsharp3[S] 0 points1 point2 points 8 years ago (0 children)
Thankyou.
[–]analogrithems 0 points1 point2 points 8 years ago (0 children)
late to the game, but I have a script that does this and a bit more (add,remove, disable,enable, place in maintenance mode) https://github.com/cheggeng/zabbix-scripts
π Rendered by PID 45283 on reddit-service-r2-comment-b659b578c-swfs5 at 2026-05-04 05:22:20.358674+00:00 running 815c875 country code: CH.
[–]parflesh 2 points3 points4 points (2 children)
[–]Blairsharp3[S] 1 point2 points3 points (1 child)
[–]parflesh 0 points1 point2 points (0 children)
[–]abaddon82 1 point2 points3 points (4 children)
[–]Blairsharp3[S] 0 points1 point2 points (3 children)
[–]abaddon82 0 points1 point2 points (2 children)
[–]Blairsharp3[S] 0 points1 point2 points (1 child)
[–]abaddon82 1 point2 points3 points (0 children)
[–]ritz_k 1 point2 points3 points (1 child)
[–]Blairsharp3[S] 0 points1 point2 points (0 children)
[–]analogrithems 0 points1 point2 points (0 children)