1 | 1 | simandl | |
2 | | | |
3 | | | How does it work? |
4 | | | ------------------------- |
5 | | | |
6 | | | Core component is the "rrdtimer.pl" script which controls all subprocesses |
7 | | | (modules). On startup, all modules that are configured in the settings |
8 | | | variable "RUN" will be started. rrdtimer waits for their PID to be written |
9 | | | into the module's PID-file and reads it on creation. All PIDs will be stored |
10 | | | into a certain datastructure for later use. |
11 | | | |
12 | | | After starting and initializing all modules, rrdtimer will tell all modules to |
13 | | | start their data-sampling (one-shot) and fall into an approximately 10-second |
14 | | | sleep. |
15 | | | |
16 | | | rrdtimer uses signalling techniques to "communicate" with its sub-processes. |
17 | | | The main process sends SIGUSR1 to the modules' read-data.pl scripts to tell |
18 | | | them to start sampling. |
19 | | | |
20 | | | Why do we use signals? |
21 | | | |
22 | | | This signalling technique has the big advantage that the module can call a |
23 | | | "sleep forever" when samlping is done, and it would automatically wake |
24 | | | up when a signal arrives. |
25 | | | |
26 | | | |
27 | | | To finally generate the diagrams, rrdtimer calls the main "diagrams.pl" script |
28 | | | which will be running detached in the background to ensure no interference |
29 | | | of the quite sensitive timebase. The diagrams script will be started with a |
30 | | | nice-level of 10 to keep system load lowest possible while ensuring to get all |
31 | | | diagrams created in time. It will call all configured (main settings -> SHOW) |
32 | | | modules' "diagrams.pl" scripts which generate all graphics. |
33 | | | |
34 | | | |
35 | | | If the "ImageMagick" package is installed, every CTIME hours the thumbnail |
36 | | | images on the main page will be updated. They are just smaller versions of all |
37 | | | configured (main settings -> SHOW) modules' weekly graphs. |
38 | | | |
39 | | | |
40 | | | into the guts |
41 | | | ------------------------- |
42 | | | |
43 | | | Each module contains a "read-data.pl" script which - when started - imports |
44 | | | all vital functions from HotSaNICmod.pm in the "lib" directory and initializes |
45 | | | itself. |
46 | | | To do so, the common.pm will be imported from the platform directory which |
47 | | | contains the configuration parser for all module-dependent settings. The script |
48 | | | also imports one of the modules' OS-dependent libraries. These libraries each |
49 | | | contain a "sample" function which takes care of the data-handling. This |
50 | | | function also calls the makerrd script in case there's no database for the |
51 | | | target already. |
52 | | | |