Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded...

29
Putting Your Jobs Under the Microscope using OGRT FOSDEM 2017 05.02.2017 Brussels, Belgium https://goo.gl/QmJ1ks

Transcript of Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded...

Page 1: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Putting Your JobsUnder the

Microscope usingOGRTFOSDEM 2017

05.02.2017Brussels, Belgium

https://goo.gl/QmJ1ks

Page 2: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python
Page 3: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Hello. Who am I?

Georg Rath@og_rath

Systems EngineerFreelancer

Page 4: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

What is a job?

Page 5: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

What is happening inside the job?

program executionshared libraries

environmentloaded modules

Page 6: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Why would you wantto know?

What software do my users run?Unoptimized Python from the home directory?Binary build of some software?

Some algebra library had a bug - are my users affected?Which jobs used that library?

Can I reduce the number of applications?Is the environment "sane"?

Are there problematic environment variables set?

Page 7: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

How would you do it?

Page 8: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Existing Solutions

1. "We use this pipeline: 'mnseq_4_custom_3.Copy 2.sh'."2. Go through the shell script, check the programs, module loads

without versions, hardcoded paths, everything you could andcould not imagine.

3. Rinse, repeat

Asking the users

Page 9: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Existing SolutionsHooking module loads

module load cd-hitmodule load embossmodule load hmmermodule load ncbi-blastmodule load ncbi-blast+module load mafftmodule load muscle

A sample ~/.profile:

load ≠ use

Page 10: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

What does OGRT do?Tracks execution of all programs in a jobTrack every shared object a program loadsEmbeds a signature into programs and shared objects*Outputs data to Elasticsearch/Splunk in near-realtime

Page 11: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

What makes OGRT unique?Works without a launcherLightweightTransparentResistant to outside influenceNo runtime dependenciesEasy to deploy

Page 12: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

How does it work?

Page 13: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Tracking Programs

LD_PRELOAD

The loader "preloads" a shared objectwhen loading a dynamic executable.

No Launcher/Wrapper

...combine with a GCC 'constructor':

Page 14: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Watermarking(Signature)

Link in an object file at compile timeCreates a note section in ELF (GCC does this too)

gets loaded into memory on executionembeds an UUIDcan be read by readelf/OGRT

Page 15: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Why the signature?same path - different executable

recompile of softwarediscern user generated programsunique identifier

Page 16: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Example of Signature

Page 17: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

R

libogrt.so

libblas.so

signature

libR.so

signature

libgomp.so

signature

libc.so

Reading Signatures

Page 18: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

But wait! There is more...support for sending environment

some/all variablessupport for sending loaded modulessend every execution

or blacklist /usr, /bin, etc.configurable at compile-time

Page 19: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

How do we persistthe gathered data?

Page 20: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

The Transport

libogrt.so(client)

Data Storeogrt-server Elasticsearch

SplunkFile*

*for debugging only

UDP

Page 21: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

ogrt-serverwritten in Goreceive and decode dataforward to configurable outputsbuffers dataembedded web-server

Page 22: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Metrics

Page 23: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

A brokenlibrary...

Page 24: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Benefits of usingElasticSearch

you get access to the whole ecosystemanalytics with Kibanayou can combine data with Grafanastability and performance

Page 25: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Deployment in a slide

wget -q https://github.com/georg-rath/ogrt/releases/download/v0.4.1/ogrt-server-v0.4.1.tar.bz2tar xf ogrt-server-v0.4.1.tar.bz2cd ogrt-server-v0.4.1./ogrt-server

Server

git clone https://github.com/georg-rath/ogrt.gitcd ogrt/client./vendorize./configure --prefix=/tmp/ogrtmake installLD_PRELOAD=$(find /tmp/ogrt/ -name libogrt.so) OGRT_ACTIVE=1 bash# every command you run in the spawned bash gets sent to the serverls

Client

Page 26: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Conclusion

giving you deep insight into what runs on your machinea versatile tool for the sysadmins toolboxconfigurable to your needsvery easy to deploy (literally in 10 minutes)

OGRT is

With OGRT you canprovide a census of used software (including user-built)troubleshoot problems with user’s programs picking upunexpected shared librariesretroactively inform users about buggy librariescontribute to reproducibility of application runs

Page 27: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

OutlookBuilt-in QueriesSyslog transport (format?)eBPF evaluationSymbol level tracking (has the function x() been used)

Page 28: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Questions?

Page 29: Putting Your Jobs Under the Microscope using OGRT€¦ · shared libraries environment loaded modules. Why would you want to know? What software do my users run? Unoptimized Python

Thank youhttps://github.com/georg-rath/ogrt