Monitor Your Business

Post on 06-May-2015

5.708 views 1 download

Transcript of Monitor Your Business

Monitor your Business

Lars Jankowfsky, CTO, swoodoo GmbH

Who is talking ?

Lars Jankowfsky:

- CTO swoodoo.com

- php since php/fi

- Developer since 15 years

Lars Jankowfsky, swoodoo.com

Preface

- No rocket science today

- using existing widespread tools to create intelligent business monitoring

- nagios

- cacti

Lars Jankowfsky, swoodoo.com

Nagios

- popular open source network monitoring software

- usually used mostly for networking/service monitoring ( load,ping,mysql...)

- http://www.nagios.org

- http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html

Lars Jankowfsky, swoodoo.com

- we will use it to modify some business values

Nagios for business monitoring

- orders (eCommerce)

- imported data (webservices)

- customer activity (web 2.0)

- ...

Lars Jankowfsky, swoodoo.com

Nagios - the script

Lars Jankowfsky, swoodoo.com

#!/usr/bin/php<?php

$value = rand(0,100);

if ($value < 50) { echo("VALUE WARNING - we got $value|v=$value"); exit(1);} else { echo("VALUE OK - we got $value|v=$value"); exit(0);}

Plugin Return Code: 0 OK 1 WARNING 2 CRITICAL 3 UNKNOWN

diff types - we use active (nagios calls)

passive checks write into nagios command file, and later nagios reads. Asynchronous

Nagios - settings

Lars Jankowfsky, swoodoo.com

#TESTdefine command{ command_name check-php command_line $USER1$/check_php }

../etc/objects/commands.cfg

define service{ use local-service ; Name of service template to use host_name localhost service_description PHP check_command check-php }

../etc/objects/localhost.cfg

Nagios - the result

Lars Jankowfsky, swoodoo.com

cacti

- popular open source RRD graphing tool

- http://www.cacti.net

- apt-get install cacti

Lars Jankowfsky, swoodoo.com

cacti - for business monitoring

- graphs for management e.g.

- orders, sales

- conversion rates

- booking/visitor rate

- import/sec. rate

- ...

Lars Jankowfsky, swoodoo.com

cacti - the script

Lars Jankowfsky, swoodoo.com

very basic example...

#!/usr/bin/php<?php

// input in $argv

$a = rand(0,100);$b = rand(0,100);

echo("OK:$a ERR:$b");

/usr/local/share/cacti/scripts/test.php

cacti - configuration

Lars Jankowfsky, swoodoo.com

#1 - create data input method

advice: add suffix ‘Data Input Method’.

cacti - configuration

Lars Jankowfsky, swoodoo.com

#2 - add data input method fields

cacti - configuration

Lars Jankowfsky, swoodoo.com

#3 - create data template

cacti - configuration

Lars Jankowfsky, swoodoo.com

#4 - add data template fields

Maximum value 0 has special meaning. It means that threshold for maximum value.

be sure that everything is correct. No changes possible later!

cacti - configuration

Lars Jankowfsky, swoodoo.com

#5 - create graph template...#6 - create graph template items

after that add type „legend“

cacti - configuration

Lars Jankowfsky, swoodoo.com

#6 - create graph template items

cacti - configuration

Lars Jankowfsky, swoodoo.com

#7 - create graph

make sure that everything is correct. You can‘t change contents later - need to recreate

cacti - configuration

Lars Jankowfsky, swoodoo.com

#7 - add into tree

cacti - that‘s it...

Lars Jankowfsky, swoodoo.com

Talking about the php....

Lars Jankowfsky, swoodoo.com

- no reason to hack!

- use same source for cacti and nagios!

- don‘t forget the tests...

Talking about the php....

Lars Jankowfsky, swoodoo.com

Lars Jankowfsky, swoodoo.com

Questions?

Lars Jankowfsky, swoodoo.com

Thank you for your interest!

eMail: lars.jankowfsky@swoodoo.com