Top Banner
Layout by orngjce223, CC-BY NLZGG bijeenkomst - 12 feb. 2015 --- Raymond Kuiper Automating interactions with
26

Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Apr 12, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

NLZGG bijeenkomst - 12 feb. 2015---

Raymond Kuiper

Automating interactions with

Page 2: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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

Page 3: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

sysadmins <3 automation

Page 4: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

the sysadmin vs monitoring

Page 5: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

automation in Zabbix

Page 6: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

how to automate via the API?

Page 7: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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

Page 8: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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

Page 9: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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

Page 10: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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

Page 11: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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

Page 12: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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

Page 13: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

my solution?

Page 14: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

*nix The IT swiss army knife

Page 15: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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

Page 16: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

Introducing:the Zabbix Gnomes

Page 17: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

Zabbix Gnomes

https://github.com/q1x/zabbix­gnomes

Page 18: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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] [­­no­verify] [­c CONFIG] [­n] [­e] hostgroup

Page 19: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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

Page 20: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

Zabbix Gnomes

user@localhost$ ./zghostfinder.py 'Linux Servers'

WakizashiKodachiKatana

Page 21: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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

Page 22: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

Zabbix Gnomes

user@localhost$ ./zgetgraph.py ­f graph.png 557

Page 23: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

Zabbix Gnomes

Making them work together

Page 24: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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 

Page 25: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

Layou

t by o

rngjc

e2

23

, C

C-B

Y

Questions?

Page 26: Automating interactions with Zabbix (Raymond Kuiper / 12-02-2015)

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