Skip to content

42labs-selection-process-v3-B-Mugnol created by GitHub Classroom

Notifications You must be signed in to change notification settings

42sp/42labs-selection-process-v3-B-Mugnol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42 Labs 3rd Edition

Challenge

This is the technical challenge for 42 Labs 3rd Edition's selection process. It constitutes of creating a web monitoring tool using C.

Requirements

This program was created and tested in an UNIX environment with default C libs, clang compiler and libcurl installed. Its capacity to compile and run in other environments is completely untested.

Usage

Compiling

To compile, simply clone this repository and run make in its root directory.

git clone https://github.com/42sp/42labs-selection-process-v3-B-Mugnol.git Labs_B-Mugnol
cd Labs_B-Mugnol
make

This will generate our program, called monitoring by default (Makefile variable NAME).

Input setup

The services to be monitored must have their information stored in a file named monitoring.db (defined in inc/define.h as I_FILE) in the root of the cloned repository, following the format examplified below. Each service configuration must be in its own (single) line. Fields are separated by any quantity of TAB's ['\t']. Commentaries (lines beginning with #) and empty lines are ignored.

Protocols are limited to HTTP, PING and DNS.

# monitoring.db

# HTTP services:
# name		protocol	address			HTTP method	expected HTTP code	interval
intra 42	HTTP		intra.42.fr		GET		301			30

# PING services:
# name		protocol	address			interval
game ping	PING		game.42sp.org.br	15

# DNS services:
# name		protocol	address			interval
workspaces	DNS		workspaces.42sp.org.br	60

Most fields are self-explanatory. The interval fields indicates how often, in seconds, a service will be monitored and generate a new output.

You can have multiple services of diverse protocols written to monitoring.db in any order, as long as each configuration line respects its protocol's field formatting.

Note: only HTTP services using the HEAD method work

Executing

Execute the program generated (monitoring by default) in the Compiling step.

./monitoring [--simplify]

The optional flag --simplify is accepted, although its functionality is yet to be implemented.

Output

For now, the program appends the result of HTTP HEAD requests to the monitoring.log file (defined in inc/define.h as O_FILE). A maximum of MAX_DATA_FETCHS (defined in inc/protocol.h) results are written per service correctly specified in monitoring.db.

About

42labs-selection-process-v3-B-Mugnol created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published