{"id":20644009,"url":"https://github.com/adjust/zabbix-api","last_synced_at":"2025-09-26T19:31:25.641Z","repository":{"id":13485769,"uuid":"16176138","full_name":"adjust/zabbix-api","owner":"adjust","description":"perl zabbix bindings","archived":false,"fork":false,"pushed_at":"2014-08-21T10:35:38.000Z","size":276,"stargazers_count":1,"open_issues_count":2,"forks_count":2,"subscribers_count":74,"default_branch":"master","last_synced_at":"2024-11-16T16:14:28.710Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adjust.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-23T15:19:52.000Z","updated_at":"2019-04-26T14:50:36.000Z","dependencies_parsed_at":"2022-08-31T08:41:39.087Z","dependency_job_id":null,"html_url":"https://github.com/adjust/zabbix-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adjust%2Fzabbix-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adjust%2Fzabbix-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adjust%2Fzabbix-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adjust%2Fzabbix-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adjust","download_url":"https://codeload.github.com/adjust/zabbix-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234338053,"owners_count":18816450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-16T16:14:32.147Z","updated_at":"2025-09-26T19:31:20.340Z","avatar_url":"https://github.com/adjust.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"zabbix-api\n==========\n\nperl zabbix bindings\n\n## Api usage\n\nFirst create a ZabbixApi Object:\n\n```perl\nuse ZabbixApi;\n\nmy $api = ZabbixApi-\u003enew(\n    user =\u003e 'winston',\n    pw   =\u003e 'gayhaim69',\n    url  =\u003e 'http://my.domain.com/api_jsonrpc.php',\n);\n```\n\nNow you can use the zabbix api described in the documentation like this.\nLet us first get the hostgroup id of `Linux servers`.\n\n```perl\n# set api method\n$zabbix-\u003eset_method('hostgroup.get');\n\n# wrapper around output: set to 'extend'\n$zabbix-\u003epayload-\u003eset_output(3);\n\n# perform api call\n$zabbix-\u003eprocess;\n\n# find the Object describing Linux servers group\nmy $o = $zabbix-\u003efind_by( 'name', 'Linux servers' );\n\n# we got a hash\nmy $id = $$o{'groupid'};\n\n# clear the api buffer before the next action\n\n$zabbix-\u003eclear;\n\n```\n\nNow we can create a host that is in this hostgroup\n\n```perl\n# set api method\n$zabbix-\u003eset_method('host.create');\n\n# add the new hostgroup\n$zabbix-\u003eadd_params( { groups =\u003e [ { 'groupid' =\u003e $id } ] } );\n\n# add the interfaces\n$zabbix-\u003eadd_params(\n    {\n        interfaces =\u003e\n        [\n            {\n                 'useip' =\u003e 1,\n                 'ip'    =\u003e '188.187.123.123',\n                 'port'  =\u003e '10050',\n                 'dns'   =\u003e 'test.com',\n                 'type'  =\u003e 1,\n                 'main'  =\u003e 1,\n            }\n        ]\n    }\n);\n\n# add the new hostname\n$zabbix-\u003eadd_params( { 'host' =\u003e 'testhost' } );\n\n# perform the api call which creates the hostgroup\n$zabbix-\u003eprocess;\n```\nOf course you can add all the params in one `add_params` call. It takes every hash ref as an argument.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadjust%2Fzabbix-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadjust%2Fzabbix-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadjust%2Fzabbix-api/lists"}