Code Monkey home page Code Monkey logo

nxs-go-zabbix's People

Contributors

borisershov avatar mfreeman451 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nxs-go-zabbix's Issues

Filter by tags

Hi,
Is posible to filter by tags?

I'll try:

`
hObjects, _, err := z.HostGet(zabbix.HostGetParams{
SelectTags: zabbix.SelectExtendedOutput,
GetParameters: zabbix.GetParameters{
Limit: 3,
Filter: map[string]interface{}{
"tags": zabbix.HostTagObject{Tag: "Backup", Value: "1", Operator: 0},
},
Output: zabbix.SelectExtendedOutput,
},
})
for _, h := range hObjects {
fmt.Println(h.HostID, ";", h.Host, ";", h.Tags, ";")
}

`
but it's not working, show all hosts.

And how filter multiple tags?

When using z.HostCreate to create SNMP type hosts, I think Details should not need slicing, using slicing will report an error: Incorrect arguments passed to function.

thisHost := zabbix.HostObject{
	Host: "api-snmp-host",
	Interfaces: []zabbix.HostinterfaceObject{
		{
			Type:  zabbix.HostinterfaceTypeSNMP,
			Main:  zabbix.HostinterfaceMainDefault,
			UseIP: zabbix.HostinterfaceUseipIP,
			IP:    "127.0.0.1",
			DNS:   "",
			Port:  "161",
			Details: zabbix.HostinterfaceDetailsTagObject{
				Version:   zabbix.HostinterfaceDetailsTagVersionSNMPv2c,
				Community: "{$SNMP_COMMUNITY}",
				Bulk:      zabbix.HostinterfaceDetailsTagBulkDontUse,
			},
		},
	},
	Groups: []zabbix.HostgroupObject{
		{
			GroupID: 16,
		},
	},
	// Templates: []zabbix.TemplateObject{
	// 	{
	// 		TemplateID: 10283,
	// 	},
	// },
}
_, _, err = z.HostCreate([]zabbix.HostObject{thisHost})
if err != nil {
	Logger.Println("[HostCreate error]:", err)
	return
}

{"jsonrpc":"2.0","method":"host.create","params":[{"host":"api-snmp-host","groups":[{"groupid":16}],"interfaces":[{"dns":"","ip":"127.0.0.1","main":1,"port":"161","type":2,"useip":1,"details":[{"version":2,"community":"{$SNMP_COMMUNITY}"}]}]}],"auth":"0431bdb48d29fd8ebb7de518b68a3c52","id":1}
[LOG]2022/12/20 20:52:56 main.go:156: [HostCreate error]: Incorrect arguments passed to function. Invalid params.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.