Monitor Your Business

24
Monitor your Business Lars Jankowfsky, CTO, swoodoo GmbH

Transcript of Monitor Your Business

Page 1: Monitor Your Business

Monitor your Business

Lars Jankowfsky, CTO, swoodoo GmbH

Page 2: Monitor Your Business

Who is talking ?

Lars Jankowfsky:

- CTO swoodoo.com

- php since php/fi

- Developer since 15 years

Lars Jankowfsky, swoodoo.com

Page 3: Monitor Your Business

Preface

- No rocket science today

- using existing widespread tools to create intelligent business monitoring

- nagios

- cacti

Lars Jankowfsky, swoodoo.com

Page 4: Monitor Your Business

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

Page 5: Monitor Your Business

Nagios for business monitoring

- orders (eCommerce)

- imported data (webservices)

- customer activity (web 2.0)

- ...

Lars Jankowfsky, swoodoo.com

Page 6: Monitor Your Business

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

Page 7: Monitor Your Business

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

Page 8: Monitor Your Business

Nagios - the result

Lars Jankowfsky, swoodoo.com

Page 9: Monitor Your Business

cacti

- popular open source RRD graphing tool

- http://www.cacti.net

- apt-get install cacti

Lars Jankowfsky, swoodoo.com

Page 10: Monitor Your Business

cacti - for business monitoring

- graphs for management e.g.

- orders, sales

- conversion rates

- booking/visitor rate

- import/sec. rate

- ...

Lars Jankowfsky, swoodoo.com

Page 11: Monitor Your Business

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

Page 12: Monitor Your Business

cacti - configuration

Lars Jankowfsky, swoodoo.com

#1 - create data input method

advice: add suffix ‘Data Input Method’.

Page 13: Monitor Your Business

cacti - configuration

Lars Jankowfsky, swoodoo.com

#2 - add data input method fields

Page 14: Monitor Your Business

cacti - configuration

Lars Jankowfsky, swoodoo.com

#3 - create data template

Page 15: Monitor Your Business

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!

Page 16: Monitor Your Business

cacti - configuration

Lars Jankowfsky, swoodoo.com

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

after that add type „legend“

Page 17: Monitor Your Business

cacti - configuration

Lars Jankowfsky, swoodoo.com

#6 - create graph template items

Page 18: Monitor Your Business

cacti - configuration

Lars Jankowfsky, swoodoo.com

#7 - create graph

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

Page 19: Monitor Your Business

cacti - configuration

Lars Jankowfsky, swoodoo.com

#7 - add into tree

Page 20: Monitor Your Business

cacti - that‘s it...

Lars Jankowfsky, swoodoo.com

Page 21: Monitor Your Business

Talking about the php....

Lars Jankowfsky, swoodoo.com

- no reason to hack!

- use same source for cacti and nagios!

- don‘t forget the tests...

Page 22: Monitor Your Business

Talking about the php....

Lars Jankowfsky, swoodoo.com

Page 23: Monitor Your Business

Lars Jankowfsky, swoodoo.com

Questions?

Page 24: Monitor Your Business

Lars Jankowfsky, swoodoo.com

Thank you for your interest!

eMail: [email protected]