{"id":20355897,"url":"https://github.com/v-zhuravlev/zabbixapi","last_synced_at":"2025-07-30T01:39:55.052Z","repository":{"id":109015860,"uuid":"71806095","full_name":"v-zhuravlev/ZabbixAPI","owner":"v-zhuravlev","description":"Zabbix API perl module provided as is.","archived":false,"fork":false,"pushed_at":"2017-12-22T15:44:11.000Z","size":12,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T18:11:02.118Z","etag":null,"topics":["zabbix","zabbix-api"],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/v-zhuravlev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-24T16:00:02.000Z","updated_at":"2019-11-04T22:08:58.000Z","dependencies_parsed_at":"2023-04-14T10:47:16.675Z","dependency_job_id":null,"html_url":"https://github.com/v-zhuravlev/ZabbixAPI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/v-zhuravlev/ZabbixAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-zhuravlev%2FZabbixAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-zhuravlev%2FZabbixAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-zhuravlev%2FZabbixAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-zhuravlev%2FZabbixAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/v-zhuravlev","download_url":"https://codeload.github.com/v-zhuravlev/ZabbixAPI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-zhuravlev%2FZabbixAPI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267793715,"owners_count":24145084,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["zabbix","zabbix-api"],"created_at":"2024-11-14T23:14:25.853Z","updated_at":"2025-07-30T01:39:55.041Z","avatar_url":"https://github.com/v-zhuravlev.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZabbixAPI\nZabbix API perl module provided as is.\n\n## Dependencies  \nPerl modules required:  \n```\nLWP\nJSON::XS\n```\nThere are numerous ways to install them:  \n\n| in Debian  | In Centos* | using CPAN | using cpanm|  \n|------------|-----------|------------|------------|  \n|  `apt-get install libwww-perl libjson-xs-perl` | `yum install perl-JSON-XS perl-libwww-perl perl-LWP-Protocol-https` | `PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'install Bundle::LWP'` and  `PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'install JSON::XS'` | `cpanm install LWP` and `cpanm install JSON::XS`|  \n\n## Sample usage  \n### Login / logout\n```perl\n$zbx = ZabbixAPI-\u003enew( { api_url =\u003e $url, username =\u003e $user, password =\u003e $password } );\n$zbx-\u003elogin();\n## DO SOMETHING\n$zbx-\u003elogout();\n```\n\n### Get params from raw JSON(copy and paste params from Zabbix API documentation examples):  \n```perl\n$json = \u003c\u003c'END_PARAMS';\n{\n        \"output\": [\"host\",\"name\",\"hostid\",\"status\"],\n        \"selectInventory\": \"extend\",\n        \"search\": {\"host\":\"myname\"}\n}\nEND_PARAMS\n\nmy $host_result = $zbx-\u003edo_raw('host.get',$json);\n```\n### Or prepare params using perl hash:  \n```perl\nmy $json = {\n             hostid =\u003e 10084,\n             selectParentTemplates =\u003e 'extend'\n            };\n\nmy $host_obj=$zbx-\u003edo('host.get',$json);\n```\n### Create mediatype\n```perl\n#setup email\n$json = \u003c\u003c'END_PARAMS';\n    {\n        \"description\": \"E-mail localhost only\",\n        \"type\": 0,\n        \"smtp_server\": \"localhost\",\n        \"smtp_helo\": \"localhost\",\n        \"smtp_email\": \"admin@localhost.localdomain\"\n    }\nEND_PARAMS\n\n\n$params = JSON::XS-\u003enew-\u003eutf8-\u003edecode($json);\n$result = $zbx-\u003ecreate_or_update_mediatype($params);\n```\n\n\n### Import Templates from XML files (with create,update,delete options all ticked)  \n```perl\n$zbx-\u003eimport_configuration_from_file(\"$file\");\n```\n### Import all Templates from XML files in specific directory:  \n```perl\n#!/usr/bin/perl\nuse warnings;\nuse strict;\n\nuse FindBin qw($Bin);\nuse lib \"$Bin/ZabbixAPI\";\n\nuse Data::Dumper;\nuse ZabbixAPI;\nmy $username = 'Admin';\nmy $password = 'zabbix';\nmy $api_url = 'http://localhost/zabbix/api_jsonrpc.php';\n\nmy $zbx;\nmy $params;\nmy $json;\nmy $result;\n$zbx = ZabbixAPI-\u003enew( { api_url=\u003e$api_url, username =\u003e $username, password =\u003e $password } );\n\n$zbx-\u003elogin();\n\nmy $temp_dir = $ARGV[0] or die \"Please provide directory with templates as first ARG\\n\"; \n\n    opendir my $dir, $temp_dir  or die \"Cannot open directory: $!\";\n    my @files = grep { /\\.xml$/ \u0026\u0026 -f \"$temp_dir/$_\" } readdir($dir);\n    closedir $dir;\n\n    foreach my $file (@files) {\n            print $file.\"\\n\";\n            $zbx-\u003eimport_configuration_from_file(\"$temp_dir/$file\");\n    }\n\n\n\n$zbx-\u003elogout();\n```\n\n\n### Import all images from directory and make them icons (mass import of icons)  \nsee https://github.com/v-zhuravlev/ZabbixAPI/blob/master/bin/zabbix-add-images.pl sample script. Then run  \n`perl zabbix-add-images.pl dir_with_png_icons`  \nor  \n`perl zabbix-add-images.pl png_icon_file`  \n\nFor example:  \n```\n[vagrant@zabbix-lab zabbix]$ perl zabbix-add-images.pl zbx_pics/zabbix_import/\nzbx_pics/zabbix_import//aircondition.png\nzbx_pics/zabbix_import//dlink_des3526.png\nzbx_pics/zabbix_import//dlink_des3526_10px.png\nzbx_pics/zabbix_import//dlink_des3526_15px.png\nzbx_pics/zabbix_import//dlink_des3526_25px.png\nzbx_pics/zabbix_import//dlink_des3528.png\nzbx_pics/zabbix_import//dlink_des3528_10px.png\nzbx_pics/zabbix_import//dlink_des3528_15px.png\nzbx_pics/zabbix_import//dlink_des3528_25px.png\n...\nzbx_pics/zabbix_import//ubnt_sector_l_100px.png\nzbx_pics/zabbix_import//ubnt_sector_l_25px.png\nzbx_pics/zabbix_import//ubnt_sector_l_50px.png\nzbx_pics/zabbix_import//ubnt_sector_r.png\nzbx_pics/zabbix_import//ubnt_sector_r_100px.png\nzbx_pics/zabbix_import//ubnt_sector_r_25px.png\nzbx_pics/zabbix_import//ubnt_sector_r_50px.png\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv-zhuravlev%2Fzabbixapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fv-zhuravlev%2Fzabbixapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv-zhuravlev%2Fzabbixapi/lists"}