{"id":34171045,"url":"https://github.com/zabbix-tools/g2z","last_synced_at":"2026-03-12T19:34:31.472Z","repository":{"id":36739079,"uuid":"41045675","full_name":"zabbix-tools/g2z","owner":"zabbix-tools","description":"Write Zabbix modules in Go!","archived":false,"fork":false,"pushed_at":"2018-08-29T02:06:42.000Z","size":60,"stargazers_count":56,"open_issues_count":5,"forks_count":8,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-01-14T13:48:35.907Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zabbix-tools.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":"2015-08-19T16:22:59.000Z","updated_at":"2024-11-07T15:37:12.000Z","dependencies_parsed_at":"2022-09-05T10:50:15.785Z","dependency_job_id":null,"html_url":"https://github.com/zabbix-tools/g2z","commit_stats":null,"previous_names":["cavaliercoder/g2z"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zabbix-tools/g2z","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zabbix-tools%2Fg2z","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zabbix-tools%2Fg2z/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zabbix-tools%2Fg2z/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zabbix-tools%2Fg2z/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zabbix-tools","download_url":"https://codeload.github.com/zabbix-tools/g2z/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zabbix-tools%2Fg2z/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30439963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-12-15T11:05:45.198Z","updated_at":"2026-03-12T19:34:31.457Z","avatar_url":"https://github.com/zabbix-tools.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# g2z\n\n*Zabbix module adapter for Go*\n\n[![GoDoc](https://godoc.org/github.com/cavaliercoder/g2z?status.svg)](http://godoc.org/github.com/cavaliercoder/g2z) [![Build Status](https://travis-ci.org/cavaliercoder/g2z.svg?branch=master)](https://travis-ci.org/cavaliercoder/g2z)\n\nThis project provides [Go](https://golang.org/) bindings for creating native\nZabbix modules.\n\n__WARNING:___ Please see [issue #5](https://github.com/cavaliercoder/g2z/issues/5)\nbefore making use of this library. Single threaded workloads are fine but any\nuse of go-routines/threads (or APIs which make use of threads) will not work\nand probably never will. This is due to irreconcilable architectural differences between the\nZabbix agent and Go runtime (sad face...).\n\nZabbix modules are an effective way of extending the Zabbix agent and server to\nmonitor resources which are not natively supported by Zabbix. \n\nThere are currently two ways to extend Zabbix:\n\n* [User Parameters](https://www.zabbix.com/documentation/2.4/manual/config/items/userparameters)\n* and [Loadable Modules](https://www.zabbix.com/documentation/2.4/manual/config/items/loadablemodules?s[]=module)\n\nUser Parameters simply map agent item keys to system calls. While this is by\nfar the easiest way to extend Zabbix, User Parameters require a process fork on\nevery call (a severe performance impact under load) and typically require a\nscript interpreter such as Perl or Ruby and their dependent framework modules.\n\nLoadable Modules offer a significant performance increase (being native C\nlibraries) and *reduce* the overhead of dependencies. Unfortunately, modules\nare rarely adopted because the effort and expertise required to write one in C\nis a great deal more than writing a script in a higher level language like\nPerl.\n\nThis project aims to deliver the best of both worlds; fast, native C libraries,\nwritten in an easier high-level language (Go), with all the dependencies bundled\ninto a standalone library file.\n\nThe findings of some performance tests are listed in [performance.md](performance.md).\n\n\n## Requirements\n\n* Go v1.5.0+\n* Zabbix v2.2.0+\n* C build tools (only tested on GCC)\n\n\n## Installation\n\nThe module APIs of Zabbix v2 and v3 are currently\n[incompatible](https://support.zabbix.com/browse/ZBX-10428). As a result, you\nmust install and import the appropriate version of g2z for your targeted Zabbix\nversion.\n\nFor Zabbix v2.X:\n\n\t$ go get gopkg.in/cavaliercoder/g2z.v2\n\nFor Zabbix v3.X:\n\n\t$ go get gopkg.in/cavaliercoder/g2z.v3\n\n\n## Usage\n\nHere's a quick high-level run down on how to create a Zabbix agent module. For \nfurther guidance, there is full API documentation available on\n[godoc.org](http://godoc.org/github.com/cavaliercoder/g2z) and an\n[example module](https://github.com/cavaliercoder/g2z/blob/master/dummy/dummy.go)\nincluded in the g2z sources which implements the dummy C module published by\nZabbix.\n\nTo begin, create a mandatory `main()` entry point to your library and import\ng2z. The `main()` function will never be called but is a requirement for\nbuilding shared libraries in Go.\n\n```go\npackage main\n\nimport \"github.com/cavaliercoder/g2z\"\n\nfunc main() {\n    panic(\"THIS_SHOULD_NEVER_HAPPEN\")\n}\n\n```\n\nWrite a Go function which accepts a `*g2z.AgentRequest` parameter and returns\neither a `string`, `uint64`, `float64` or `g2z.DiscoveryData` as the first\nparameter, and an `error` as the second return parameter.\n\n```go\nfunc Echo(request *g2z.AgentRequest) (string, error) {\n    return strings.Join(request.Params, \" \"), nil\n}\n\n```\n\nCreate an `init()` function to register your functions as agent item keys. The\n`init()` function is executed by the Go runtime when your module is loaded into\nZabbix via `dlopen()`. You should not execute any other calls in this function,\nother than registering your items and init/uninit handlers.\n\n```go\nfunc init() {\n    g2z.RegisterStringItem(\"go.echo\", \"Hello world!\", Echo)\n}\n\n```\n\nThere are a few different item types you may register. Each requires an agent\nitem key name, some test parameters and a handler function for Zabbix to call\nwhen it receives a request for the registered item key.\n\nCompile your project with:\n\n```bash\n$ go build -buildmode=c-shared\n```\n\nLoad your `.so` module file into Zabbix as per the\n[Zabbix manual](https://www.zabbix.com/documentation/2.2/manual/config/items/loadablemodules#configuration_parameters).\n\nTest your item keys with `zabbix_agentd -p` or\n[zabbix_agent_bench](https://github.com/cavaliercoder/zabbix_agent_bench).\n\n\n## License\n\ng2z - Zabbix module adapter for Go\nCopyright (C) 2015 - Ryan Armstrong \u003cryan@cavaliercoder.com\u003e\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzabbix-tools%2Fg2z","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzabbix-tools%2Fg2z","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzabbix-tools%2Fg2z/lists"}