 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package zabbix implements zabbix api bot for lua.
Example (Package) ¶
example zabbix
package main
import (
	"log"
	http "github.com/lovercode/gopher-lua-libs/http"
	inspect "github.com/lovercode/gopher-lua-libs/inspect"
	zabbix "github.com/lovercode/gopher-lua-libs/zabbix"
	lua "github.com/yuin/gopher-lua"
)
func main() {
	state := lua.NewState()
	zabbix.Preload(state)
	http.Preload(state)
	inspect.Preload(state)
	source := `
local zabbix = require("zabbix")
local inspect = require("inspect")
local http = require("http")
local client = http.client({proxy="http://proxy"})
local zbx = zabbix.new({url="http://zabbix.url"}, client)
local err = zbx:login()
-- if err then error(err) end
local response, err = zbx:request("trigger.get",
    {
        selectHosts = "extend", selectItems = "extend", selectLastEvent="extend",
        output = "extend", sortfield = "priority",
        filter = {
            sortorder="DESC", value="1", status=0
        },
        expandData = "1"
    }
)
-- if err then error(err) end
for k, v in pairs( response ) do
    print(inspect(v))
    print(v.description)
end
zbx:logout()
`
	if err := state.DoString(source); err != nil {
		log.Fatal(err.Error())
	}
}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApiVersion ¶
ApiVersion lua zabbix_bot_ud:api_version() returns (string, err)
func NewBot ¶
NewBot lua zabbix.bot(config table, http_ud.client) return zabbix_bot_ud
config = {
   url = "http://zabbix.url",
   user = "user",
   password = "password",
   debug = true,
}
  
        func Preload ¶
Preload adds zabbix to the given Lua state's package.preload table. After it has been preloaded, it can be loaded using require:
local zabbix = require("zabbix")
  
        Types ¶
This section is empty.
 Click to show internal directories. 
   Click to hide internal directories.