Layout by orngjce223, CC-BY NLZGG bijeenkomst - 12 feb. 2015 --- Raymond Kuiper Automating interactions with
Layou
t by o
rngjc
e2
23
, C
C-B
Y
NLZGG bijeenkomst - 12 feb. 2015---
Raymond Kuiper
Automating interactions with
Layou
t by o
rngjc
e2
23
, C
C-B
Y
quick introduction
Raymond Kuiper
“I do something with computers”
(Fanatical) Zabbix user since 2006
Layou
t by o
rngjc
e2
23
, C
C-B
Y
sysadmins <3 automation
Layou
t by o
rngjc
e2
23
, C
C-B
Y
the sysadmin vs monitoring
Layou
t by o
rngjc
e2
23
, C
C-B
Y
automation in Zabbix
Layou
t by o
rngjc
e2
23
, C
C-B
Y
how to automate via the API?
Layou
t by o
rngjc
e2
23
, C
C-B
Y
API bash script using Curl
Pros:
Seems nice and easy at first
You can show off your mad coding skills
Layou
t by o
rngjc
e2
23
, C
C-B
Y
API bash script using Curl
Cons:
No object awareness
Honestly, it's a PITA
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Develop an API based tool
Pros:
Perfect solution to your problem
Highly efficient code
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Develop an API based tool
Cons:
Takes time and effort to develop (and debug) a fitting solution
Not very flexible unless you invest heavily in development (monolithic)
Gets very complex, very fast. You might need a developer to maintain it
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Use a CLI tool (Zabcon and friends)
Pros:
Can be used in shell scripts
Can be used quickly, no need for direct API code
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Use a CLI tool (Zabcon and friends)
Cons:
Learning a new CLI language
Limited to the functionality the developer thought was useful
Layou
t by o
rngjc
e2
23
, C
C-B
Y
my solution?
Layou
t by o
rngjc
e2
23
, C
C-B
Y
*nix The IT swiss army knife
Layou
t by o
rngjc
e2
23
, C
C-B
Y
*nix The IT swiss army knife
“The whole is greater than the sum of its parts.”
― Aristotle
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Introducing:the Zabbix Gnomes
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Zabbix Gnomes
https://github.com/q1x/zabbixgnomes
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Zabbix Gnomes
user@localhost$ ./zghostfinder.py helpusage: zghostfinder.py [h] [u USERNAME] [p PASSWORD]
[a API] [noverify] [c CONFIG] [n] [e] hostgroup
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Zabbix Gnomes
~/.zbx.conf
[Zabbix API] username=johndoe password=verysecretpassword api=https://zabbix.mycompany.com/path/to/zabbix/frontend/ no_verify=true
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Zabbix Gnomes
user@localhost$ ./zghostfinder.py 'Linux Servers'
WakizashiKodachiKatana
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Zabbix Gnomes
user@localhost$ ./zhgraphfinder.py e Kodachi
568:Network traffic on eth0555:CPU jumps556:CPU load557:CPU utilization558:Swap usage569:Disk space usage /560:Memory usage
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Zabbix Gnomes
user@localhost$ ./zgetgraph.py f graph.png 557
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Zabbix Gnomes
Making them work together
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Zabbix Gnomes
#!/bin/bash# This scripts downloads the 'CPU utilisation' # graphs for a group of Zabbix hosts.## Find hosts in group 'Linux Servers'for host in $(./zghostfinder.py 'Linux Servers'); do
# Get Graphid graphid=$(./zhgraphfinder.py e $host | \grep 'CPU utilization' | cut d ':' f 1)
# Download graph./zgetgraph.py f $host.png $graphid
done
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Questions?
Layou
t by o
rngjc
e2
23
, C
C-B
Y
Zabbix Events
Zabbix Professional Training13-17 april 2015
http://www.zabbix.com/training.php
Zabbix Conference 201511-12 september 2015
http://www.zabbix.com/lv/newsletters/2015/newsletter_january_15.html