zabbix-agent aggregation proxy daemon.
github.com/fujiwara/zabbix-aggregate-agent
$ git clone http://github.com/fujiwara/zabbix-aggregate-agent
$ cd zabbix-aggregate-agent
$ go build
$ zabbix-aggregate-agent --config /path/to/config.toml
[[agent]]
# Name: Identifier
Name = "web_servers"
# Listen: Listen address (default "127.0.0.1:10052")
Listen = "0.0.0.0:10052"
# List : List of agents' address to aggregate
List = [ "web01:10050", "web02:10050" ]
# Timeout: Timeout seconds for getting reply from agent (default 60)
Timeout = 10
# LogLevel: "Debug", "Info" or "Error" (default "Info")
LogLevel = "Debug"
[[agent]]
Name = "app_servers"
Listen = "0.0.0.0:10053"
# ListFile: Specify the file of list of agent. ("\n" delimited)
ListFile = "/path/to/agent.list"
[[agent]]
Name = "db_servers"
Listen = "0.0.0.0:10054"
# ListCommand: Specify a command and arguments to output list of agent address. ("\n" delimited)
ListCommand = [ "/path/to/generate_list.sh", "arg1", "args2" ]
# CacheExpires : Seconds for expiring a cache of ListCommand result. (default 0 == no cache)
# Enabled only when specify "ListCommand"
CacheExpires = 300
[zabbix-server(or zabbix-proxy)]
| ^
| (1)key | (6)aggregated value
| |
v |
[zabbix-aggregate-agent] <--- (2) list of zabbix-agents from static list or file or command output
| ^
| (3)key | (4)values(*)
v |
[zabbix-agents(*)]
$ zabbix-aggregate-agent --config config.toml
2014/02/27 19:48:19 Loading config file: config.toml
----------------------------------
[[agent]]
Name = "example"
List = ["10.8.0.1:10050", "10.8.0.2:10050"]
LogLevel = "Debug"
----------------------------------
2014/02/27 19:48:19 Initialize agent example
2014/02/27 19:48:19 INFO [example] Listing 127.0.0.1:10052
2014/02/27 19:48:19 INFO [example] Ready for connection
$ zabbix_get -s 127.0.0.1 -p 10052 -k "system.uptime"
66407369
2014/02/27 19:48:49 DEBUG [example] Accepted connection from 127.0.0.1:65038
2014/02/27 19:48:49 DEBUG [example] Key: system.uptime
2014/02/27 19:48:49 DEBUG [example] List: [10.8.0.1:10050 10.8.0.2:10050]
2014/02/27 19:48:49 DEBUG [example] Sending key: system.uptime to 10.8.0.1:10050
2014/02/27 19:48:49 DEBUG [example] Sending key: system.uptime to 10.8.0.2:10050
2014/02/27 19:48:49 DEBUG [example] Replied from 10.8.0.1:10050 in 25 msec: 53034117
2014/02/27 19:48:49 DEBUG [example] Replied from 10.8.0.2:10050 in 71 msec: 13373252
2014/02/27 19:48:49 DEBUG [example] Aggregated system.uptime = 66407369
2014/02/27 19:48:49 DEBUG [example] Closing connection: 127.0.0.1:65038
$ zabbix_get -s 127.0.0.1 -p 10052 -k "system.cpu.load[]"
0.360000
2014/02/27 19:55:38 DEBUG [example] Accepted connection from 127.0.0.1:65080
2014/02/27 19:55:38 DEBUG [example] Key: system.cpu.load[]
2014/02/27 19:55:38 DEBUG [example] List: [10.8.0.1:10050 10.8.0.2:10050]
2014/02/27 19:55:38 DEBUG [example] Sending key: system.cpu.load[] to 10.8.0.1:10050
2014/02/27 19:55:38 DEBUG [example] Sending key: system.cpu.load[] to 10.8.0.2:10050
2014/02/27 19:55:38 DEBUG [example] Replied from 10.8.0.1:10050 in 26 msec: 0.160000
2014/02/27 19:55:38 DEBUG [example] Replied from 10.8.0.2:10050 in 71 msec: 0.200000
2014/02/27 19:55:38 DEBUG [example] Aggregated system.cpu.load[] = 0.360000
2014/02/27 19:55:38 DEBUG [example] Closing connection: 127.0.0.1:65080
$ zabbix_get -s 127.0.0.1 -p 10052 -k "system.uname"
Linux www 3.2.0-25-generic #40-Ubuntu SMP Wed May 23 20:30:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Linux raspberrypi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l GNU/Linux
2014/02/27 19:48:55 DEBUG [example] Accepted connection from 127.0.0.1:65041
2014/02/27 19:48:55 DEBUG [example] Key: system.uname
2014/02/27 19:48:55 DEBUG [example] List: [10.8.0.1:10050 10.8.0.2:10050]
2014/02/27 19:48:55 DEBUG [example] Sending key: system.uname to 10.8.0.1:10050
2014/02/27 19:48:55 DEBUG [example] Sending key: system.uname to 10.8.0.2:10050
2014/02/27 19:48:55 DEBUG [example] Replied from 10.8.0.1:10050 in 68 msec: Linux www 3.2.0-25-generic #40-Ubuntu SMP Wed May 23 20:30:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
2014/02/27 19:48:55 DEBUG [example] Replied from 10.8.0.2:10050 in 86 msec: Linux raspberrypi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l GNU/Linux
2014/02/27 19:48:55 DEBUG [example] Aggregated system.uname = Linux www 3.2.0-25-generic #40-Ubuntu SMP Wed May 23 20:30:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Linux raspberrypi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l GNU/Linux
2014/02/27 19:48:55 DEBUG [example] Closing connection: 127.0.0.1:65041
Fujiwara Shunichiro [email protected]
MIT License