]> git.itanic.dy.fi Git - rrdd/log
rrdd
13 months agoonewire_parser.c: Fix compiler warnings about string lengths master
Timo Kokkonen [Wed, 1 Mar 2023 16:28:40 +0000 (18:28 +0200)]
onewire_parser.c: Fix compiler warnings about string lengths

Compilers are picky about not truncating the output when copying data
with strncpy. From the static buffer sizes it sees the potential
buffer truncation, so adjust the buffer sizes so that it is not
possible to truncate buffers and leave the data unterminated.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
13 months agoprocess: run_piped_stream: Use correct direction with fdopen()
Timo Kokkonen [Wed, 1 Mar 2023 16:18:29 +0000 (18:18 +0200)]
process: run_piped_stream: Use correct direction with fdopen()

The stdinf, stdoutf and stderrf all refer to the file streams from the
child, and their directions are opposite on parent side, where we are
reading from or writing to them. Therefore they are bit unintuitively
opposite to what one might thought just by quickly glancing over the
code.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
13 months agonetwork_parser: Sanitize buffer state between calls and between parsed lines
Timo Kokkonen [Wed, 1 Mar 2023 16:09:35 +0000 (18:09 +0200)]
network_parser: Sanitize buffer state between calls and between parsed lines

Whenever we have finished parsing a line, the destination buffer must
be zeroed out to prevent stale data from corrupting the data.

Once data is copied from the receive buffer to the last_line buffer
and the receive buffer is moved back to the beginning, we must zero
out the old data at the end of the buffer to prevent corrupting any
new data. This can happen if we receive multiple lines in one recv()
call.

When we have finished handling one set of data, we should clear the
buffer state and data to prevent any stale data from corrupting the
data on next call. This could happen for example if the TCP transfer
is interrupted for any reason and we don't receive comlete line for
any reason.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
13 months agonetwork_parser: Use pr_* debug macros instead of printf
Timo Kokkonen [Wed, 1 Mar 2023 16:08:44 +0000 (18:08 +0200)]
network_parser: Use pr_* debug macros instead of printf

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agorrtdool: Simplify sleeptime calculation
Timo Kokkonen [Sat, 21 Nov 2020 09:41:00 +0000 (11:41 +0200)]
rrtdool: Simplify sleeptime calculation

The code can be refactored into understandable form with less lines.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agoconfig: Allow databases without filenames
Timo Kokkonen [Sat, 21 Nov 2020 09:38:18 +0000 (11:38 +0200)]
config: Allow databases without filenames

These are useful when we want to specify a job that does not have an
rrd database associated with it at all.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agoprocess: Always kick job scheduler when a worker finishes
Timo Kokkonen [Sat, 21 Nov 2020 09:34:59 +0000 (11:34 +0200)]
process: Always kick job scheduler when a worker finishes

If we happen to have a very long running job, it is not desired that
all other jobs remain stuck waiting this job to complete. This can
happen if we first start all jobs, causing the scheduler to wait
indefinitely for a "kick", then the last job takes forever to finish.

To fix this, every time a job finishes, it is better to reschedule the
job poller in case new job has become schedulable.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agorrdtool: get_last_update: Fix file descriptor leak
Timo Kokkonen [Sun, 25 Oct 2020 16:17:08 +0000 (18:17 +0200)]
rrdtool: get_last_update: Fix file descriptor leak

Any file descriptors returned by the run_piped() function must be
closed when we no longer need them. Furthermore, we really are not
interested about error stream, so don't bother requeseting it at all.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agorrdtool_update_data_multi: Discard entries with timestamp in future
Timo Kokkonen [Sun, 25 Oct 2020 16:13:58 +0000 (18:13 +0200)]
rrdtool_update_data_multi: Discard entries with timestamp in future

If parser data contains entries with timestamp in future, they should
be discarded. If such entries are allowed to be put into the rrd
database, the database will refuse to accept any more any entries,
untill current date is again above the corrupted date. Depending on
the severity of the corruption, this might prevent any further updates
to the database.

Therefore it is better to not allow any updates from future.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agoprocess: Downgrade mutex contention prints
Timo Kokkonen [Sun, 25 Oct 2020 16:13:01 +0000 (18:13 +0200)]
process: Downgrade mutex contention prints

These are not as interesting any more, so convert them to debug level
in order to reduce excess verbosity.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agorun_piped: Fix file descriptor leak on pipe() fail.
Timo Kokkonen [Sun, 25 Oct 2020 16:09:51 +0000 (18:09 +0200)]
run_piped: Fix file descriptor leak on pipe() fail.

If pipe() call fails for any reason, the already opened descriptors
need to be all closed. These typically fail if we are already leaking
descriptors elsewhere and we can't create any more new descriptors.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agonetwork_parser: Fix fd leak due to missing close after connect() fail
Timo Kokkonen [Sun, 25 Oct 2020 16:07:16 +0000 (18:07 +0200)]
network_parser: Fix fd leak due to missing close after connect() fail

If connect() fails, we still have the socket and it must be closed
that was created when we call socket() earlier.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agoReplace strncat with _strlcat
Timo Kokkonen [Sun, 11 Oct 2020 11:08:09 +0000 (14:08 +0300)]
Replace strncat with _strlcat

Using strncat is hard. The function expects you to know how many bytes
you can write in the buffer instead if figuring out itself.

Introduce a _strlcat call which correctly handles the buffer length
handling and guarantees the data is null terminated after the operation.

Even though the code here was handling the buffer length correctly,
the code is much simpler if _strlcat is used instead.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agoIntroduce network parser
Timo Kokkonen [Sun, 11 Oct 2020 11:05:38 +0000 (14:05 +0300)]
Introduce network parser

This is a first multiparser. It will fetch rrd data from a network address via tcp.

The communication protocol is simple. At first, the client (rrdd) will
send the last timestamp it had on its rrd database. Then the server
will respond with stream of rrd data, one entry per line. This data is
then fed to rrd database.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agorrdtool: Add support for multi parsers
Timo Kokkonen [Sun, 11 Oct 2020 09:40:18 +0000 (12:40 +0300)]
rrdtool: Add support for multi parsers

This new multi parser type can provide multiple data entries, each
having their own timestamp. The parsing interface is simply extended
so that the new parser returns an array of data elementrs, all in
rrdtool data format. The data is then fed directly to rrdtool via
"rrdtool update" command. New parser also is given the timestamp of
the last update.

As data timestamp is now provided by the parser, there are quite
significant implications on the timeout handling. Previously the
expectation was that each rrd database is updated only once during its
update interval and data fetching happens only once during an update
interval.

This expectation is no longer valid as the parser can return bunch of
data, which is all in past. And the parser would be happy to give even
more data if it was give a chance to do so. Therefore, the actual
"last_update" timestamp is now taken from the latest data entry. And
after each complete update, the job scheduler is notified to do a
re-schedule in order to start a new round of data acquicition in case
there is more data to parse.

The scheduler now needs to be able to wait indefinitely in case all
parsers are still active and there is no information about when a next
event is going to happen. Also a new backoff timestamp is introduced
to prevent the parser from continuously re-staring parsing in case the
data source fails to provide any new data at all.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agoIntroduce mutex_init()
Timo Kokkonen [Sun, 11 Oct 2020 09:07:56 +0000 (12:07 +0300)]
Introduce mutex_init()

This is to be used for run time mutex initialization.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agoprocess: Introduce notify_job_request()
Timo Kokkonen [Sun, 11 Oct 2020 08:59:12 +0000 (11:59 +0300)]
process: Introduce notify_job_request()

This function can be used to kick the main thread out of
poll_job_request() function in case someone wants to re-schedule rrd
processing.

As a starter, a notify call is added at the end of worker processing
when the last worker thread exits. The only purpose of this feature is
to make the main thread to print out the time of the next scheduled
job to be processed, making it just easier to follow the daemon as it
operates.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agoregister_event_handler: Make also modifications and deletes possible
Timo Kokkonen [Sun, 11 Oct 2020 08:55:42 +0000 (11:55 +0300)]
register_event_handler: Make also modifications and deletes possible

Take the op parameter as an argument that is given to
epoll_ctl(). This way the function can also modify and delete epoll
events.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agoprocess: tun_piped_stream: stdout stream should be writable
Timo Kokkonen [Sat, 10 Oct 2020 08:58:23 +0000 (11:58 +0300)]
process: tun_piped_stream: stdout stream should be writable

Change the stream type to "w" so that it can be written.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agorrdtool: Read last update timestamp from database on startup
Timo Kokkonen [Wed, 30 Sep 2020 17:44:37 +0000 (20:44 +0300)]
rrdtool: Read last update timestamp from database on startup

Instead of just re-updating all possible databases instantly on the
startup, read the last update timestamp from the database and do the
update with normal schedule.

This is useful if we just happen to restart the daemon and the last
update happened just a moment ago.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agorrdtool: Use the same timestamp with rrdtool and with logs
Timo Kokkonen [Wed, 30 Sep 2020 17:15:15 +0000 (20:15 +0300)]
rrdtool: Use the same timestamp with rrdtool and with logs

Acquiring the data and updating rrdtool database takes some time. Use
the same timestamp for both so that the times are consistent.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agorrdtool.h: Fix last_update type
Timo Kokkonen [Wed, 30 Sep 2020 17:11:43 +0000 (20:11 +0300)]
rrdtool.h: Fix last_update type

This type may not be always int, but long int instead, on 64bit
architectures at least.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agorrdtool: Fix strncat() usage
Timo Kokkonen [Wed, 30 Sep 2020 17:05:52 +0000 (20:05 +0300)]
rrdtool: Fix strncat() usage

As per strncat man page:

       If src contains n or more bytes, strncat() writes n+1 bytes to
       dest (n from src plus the terminating null byte).  Therefore,
       the size of dest must be at least strlen(dest)+n+1.

Therefore, we must ensure the destination buffere does not overflow is
src is large enough.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
3 years agorrdtool: Fix use of uninitialized buffers in string operations
Timo Kokkonen [Sat, 25 Apr 2020 14:49:26 +0000 (17:49 +0300)]
rrdtool: Fix use of uninitialized buffers in string operations

The code is completely mess, referring to incorrect buffers as it is
calculating the size of the buffer. This wouldn't be problem as both
buffers are same length, but for some reason the code is also using
strlen() for something.

Fix up the mess.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
4 years agorrdtool: Fix bug with messed up log printing
Timo Kokkonen [Sat, 14 Mar 2020 09:31:10 +0000 (11:31 +0200)]
rrdtool: Fix bug with messed up log printing

Commit 3d128efe07 forgot to take account update data strings no longer
start with "N:", but with a unix timestamp and ":". This messed up the
logs.

Fix it by parsing up to the first colon and stripping the timestamp
away.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
4 years agorrdtool: Take update time as we start updating db
Timo Kokkonen [Sat, 14 Mar 2020 07:52:01 +0000 (09:52 +0200)]
rrdtool: Take update time as we start updating db

Turns out commit 03aa50c69 didn't fix the drifting problem
completely. It is still possible that acquiring the data takes
arbitrarily long time and we end up inserting the data in the middle
of the database update interval, which will cause rrdtool to
interpolate the data point with previous or next entry.

Fix it by taking the timestamp before we start the update procedure
and using that time as we feed in the data.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
4 years agoconfig: Fix "specified bound 16 equals destination size" warning
Timo Kokkonen [Wed, 29 Jan 2020 18:01:38 +0000 (20:01 +0200)]
config: Fix "specified bound 16 equals destination size" warning

Just subtract one byte off the strncpy destination size and the null
byte will always fit.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
4 years agorrdtool: Stop update times from drifting
Timo Kokkonen [Sun, 25 Aug 2019 12:30:58 +0000 (15:30 +0300)]
rrdtool: Stop update times from drifting

With rrdtool, database updates should rather take place evenly at the
beginning of each update interval. If it happens at random places
within the interval, rrdtool will try to interpolate the data to make
it "fit better" within the data points. This causes unexpected data
values to be generated into the database.

Make each updates happen consitently at the beginning of the window to
ensure the graphs contain as good raw samples as possible.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
4 years agoonewire_parser: Implement simultaneous reading
Timo Kokkonen [Thu, 22 Aug 2019 18:27:20 +0000 (21:27 +0300)]
onewire_parser: Implement simultaneous reading

DS18S20 sensors support simultaneous reading (not if parasitic
powered). This speeds up reading of multiple sensors massively, as the
lengthy conversion is done by all sensors at the same time.

But it does not work unless explicitly started. Also we don't want to
re-start the procedure after each sensor, as that would be as slow as
reading one by one.

Thus, we add a global shared timestamp that gets set once we read the
first sensor. After that, we have 10 second time to read the rest of
the sensors until we set it again. This should be more than enough
time to read large number of sensors in very short time doing only one
parallel conversion.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
4 years agoRefactor mutex code to utils.h
Timo Kokkonen [Thu, 22 Aug 2019 18:26:31 +0000 (21:26 +0300)]
Refactor mutex code to utils.h

This is more useful here as it does not exactly belong to process
handling.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
4 years agoonewire_parser: Fix "85" degree handling case
Timo Kokkonen [Tue, 20 Aug 2019 18:38:02 +0000 (21:38 +0300)]
onewire_parser: Fix "85" degree handling case

The current method of comparing the beginning of the raw string to
"85" will discard all measurements, even valid ones that are different
than strictly "85". This includes values such as 85.5, which can be
100% correct.

This also fixes a small memory leak that took place when we actually
got "85" from the sensor. If that happens, it is a failure, but the
*_read() function still had allocated the string for us. So it must be
freed.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
4 years agoSample config: End of line white space removal
Timo Kokkonen [Tue, 20 Aug 2019 18:31:27 +0000 (21:31 +0300)]
Sample config: End of line white space removal

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
5 years agoSilence gcc-8 snprintf overflow warnings
Timo Kokkonen [Fri, 7 Sep 2018 18:16:27 +0000 (21:16 +0300)]
Silence gcc-8 snprintf overflow warnings

When compilint with gcc-8 and newer, we get warnings like:

/usr/include/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 11 and 2057 bytes into a destination of size 1024
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is because gcc thinks (correctly) that it is possible for the
resulting string to be larger than the buffer we ask snprintf to print
it. This is pretty bening warning, as we are not expecting to see this
kind of situations ever.

To work around the warning, add an error print for such cases when
actual overflow takes place. No actual memory overflow takes place
however as snprintf prevents this. But this also makes gcc happy as we
are now dealing the error case.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
6 years agoAdd support for daemonizing rrdd
Timo Kokkonen [Thu, 9 Nov 2017 19:39:30 +0000 (21:39 +0200)]
Add support for daemonizing rrdd

Daemonizing rrdd is useful if we wish to leave it running on background.

We might need to prevent it from starting multiple times, so add
support for creating and verifying a pid file as well.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoonewire_parser: Fix crash caused by off by one memory allocation
Timo Kokkonen [Sun, 29 Jan 2017 15:03:00 +0000 (17:03 +0200)]
onewire_parser: Fix crash caused by off by one memory allocation

The entries in sensor list always start with either server address or
mount point, which is not counted as a sensor. If we want to count the
actual number of sensors, we obviously need to add one more to the
last index number, otherwise we get one too small number for sensors
and allocate too little of memory for the parser state.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoonewire_parser: Increase glitch detection retry count to 4
Timo Kokkonen [Thu, 26 Jan 2017 18:36:32 +0000 (20:36 +0200)]
onewire_parser: Increase glitch detection retry count to 4

In order to detect glitches properly, we might need to do more than
two reads, especially on noisy lines. Double the amount of reads we do
so that we have better chance of removing glitches from the data.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoonewire_parser: Make step changes pass glitch detection
Timo Kokkonen [Thu, 26 Jan 2017 18:28:32 +0000 (20:28 +0200)]
onewire_parser: Make step changes pass glitch detection

The glitch detection code does not recognize step changes at
all. Currently it re-reads the temperature values until maximum glitch
threshold (two reads) and then just uses the last data. This is not
ideal on noisy lines as the last data might be a glitch itself.

Improve the logic so that after considering for a glitch, we compare
two consequent readings and see if the delta between those two is less
than the glitch threshold. If it is less, we consider the data
good. This is needed in case the temperature is changing quickly and
we don't get two identical values, but almost same.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoImprove mutex debugging prints
Timo Kokkonen [Sat, 14 Jan 2017 15:39:14 +0000 (17:39 +0200)]
Improve mutex debugging prints

When lock contention is detected, print also the name of the thread
holding the lock and also where the lock was tried to acquire.

After the lock is finally acquired after the contention, add a new
print there as well to indicate that the lock is now acquired and the
thread will continue.

This adds overhead to the mutex operations, but that shouldn't be an
issue yet. If it becomes too slow, an option can be added later to
remove the prints and the overhead altogether. Now we are more happy
about the improved verbosity of the locking operations.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoworker_thread: Drop process priority when executing low priority work
Timo Kokkonen [Sat, 14 Jan 2017 15:32:40 +0000 (17:32 +0200)]
worker_thread: Drop process priority when executing low priority work

When executing low priority work, it is a good idea to nice() the
process priority as well so that the executing of the work is truly
run as a low priority work. This decreases the interference the work
might have on the rest of the system.

To achieve this, the work executing loop is rewritten. Instead of
having a loop that always tries to execute the highest priority work,
separate the low priority and high priority handling in separate
loops. This simplifies the logic quite a bit. Furthermore, there is
really no need to convert a low priority worker back to executing high
priority work. When queuing work, a new worker thread is always
spawned whenever a high priority work is queued. Thus, there is no
really any chance a low priority worker could pick up any high
priority work once it has finished low priority work.

Now we no longer can do that as it is not possible to rise a thread
priority back up once it lowered its priority.

The executing logic of the worker thread is thus much simpler now.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoFix possible buffer overrun due to incorrect strncat length argument
Timo Kokkonen [Tue, 15 Nov 2016 17:44:47 +0000 (19:44 +0200)]
Fix possible buffer overrun due to incorrect strncat length argument

The strncat usage assumed that the length argument to strncat
indicates the length of the destination buffer. That is how strlcat
works. The length argument for strncat instead describes the maximum
number of characters to copy from the source buffer.

To make the call sites work correctly when we want to avoid
overflowing the destination buffer, we need to subtract also the
current length of the destination buffer string.

This also cures possible overflow issues with any of the strncat use
sites.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoonewire_parser: Ensure proper strng NULL handling
Timo Kokkonen [Tue, 1 Nov 2016 19:02:00 +0000 (21:02 +0200)]
onewire_parser: Ensure proper strng NULL handling

strncpy() call length argument must be one less than the actual buffer
length. The final byte in buffer must be NULL, in case strncpy does
not fill it with NULL itself.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoonewire_parser: Use larger string buffers in make_uncached()
Timo Kokkonen [Tue, 1 Nov 2016 18:56:54 +0000 (20:56 +0200)]
onewire_parser: Use larger string buffers in make_uncached()

The strings used for temperature sensor paths might be longer than 32
bytes. If that is the case, we might truncate the actual output
string, thus making temperature sensors inaccessible in case we might
need to read an uncached data from it. This become visible after the
glitch detection code started to make frequent re-reads from sensors.

Fix it by allocating 1024 bytes for the strings instead of 32
bytes. This should be more than enough.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agomkcompile_h: Use mv instead of cp
Timo Kokkonen [Tue, 1 Nov 2016 18:54:49 +0000 (20:54 +0200)]
mkcompile_h: Use mv instead of cp

Once temporary version files are done, replace the original with the
temp file instead of copying over it. We don't need the temporary copy
any more so we can move it over the target file.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoonewire_parser: Implement glitch removal
Timo Kokkonen [Fri, 28 Oct 2016 17:38:43 +0000 (20:38 +0300)]
onewire_parser: Implement glitch removal

Some times in noisy 1wire networks there might be random bit flips
during read, which slip through even from the CRC check done in
line. This might lead to errorneous readings that cause spikes to
graphs.

Implement a relatively straight forward logic for avoiding the
glitches. Here we keep a track of 20 delta values between samples and
the latest reading (so that we can calculate the new delta). If the
latest delta is significantly larger than biggest known delta within
the sample history, we will retry reading the sensor. If we get
exactly same value back we trust the reading. If the value keeps on
changing or we get too many failures, we get what we can.

This should allow recovery for most simple transient glitches.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoutils.h: min() max() cleanup
Timo Kokkonen [Fri, 28 Oct 2016 17:33:35 +0000 (20:33 +0300)]
utils.h: min() max() cleanup

min() and max() macros belong to utils.h. They should also be lower
case, just like the rest of the world tends to have them.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoAllow parsers to store private data to databases
Timo Kokkonen [Wed, 26 Oct 2016 17:55:08 +0000 (20:55 +0300)]
Allow parsers to store private data to databases

Pass a pointer to parser function where the parser can store one
pointer worth of its private state. This can be useful in different
ways whenever a parser needs to store some information between parser
calls.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agobuilt_in_parsers: Remove digitemp parser
Timo Kokkonen [Wed, 26 Oct 2016 17:54:38 +0000 (20:54 +0300)]
built_in_parsers: Remove digitemp parser

There are no users for this parser. Onewire parser replaces this one.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoonewire_parser: Fix double free corruption
Timo Kokkonen [Wed, 26 Oct 2016 17:19:12 +0000 (20:19 +0300)]
onewire_parser: Fix double free corruption

If there is a failure while reading a sensor value, the pointer
pointing to the destination buffer is undefined. In that case we might
be referring to a previously freed pointer and possibly corrupting
data somewhere else. The heap area might also be already allocated for
something else and freeing it here, making the heap area available to
yet another allocation and further corruptions. This leads to random
and hard to reproduce crashes in various unrelated components.

Fix the issue by initializing the pointer value with NULL. Also avoid
using it when we expect it to be NULL after a failure. Also we are not
passing the NULL pointer to free(), even though calling free on NULL
is bening.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoonewire_parser: Add support for reading data from file system
Timo Kokkonen [Sun, 24 Jul 2016 12:42:16 +0000 (15:42 +0300)]
onewire_parser: Add support for reading data from file system

Reading data from file system might be preferrable for example when
older ownet client code is in use and that is causing memory leaks.

In principle the logic is all the same regardless which method is
used, only the read method is different.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoonewire_parser: Fix memory leak when retrying OWNET_read()
Timo Kokkonen [Sun, 24 Jul 2016 12:39:45 +0000 (15:39 +0300)]
onewire_parser: Fix memory leak when retrying OWNET_read()

If it happens that read fails for any reason and the code retries
reading, the previous read buffer is not freed properly. This causes a
minor (26 byte) memory leak on each retry. Add a free() call to avoid
the leak.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoRevert "onewire_parser: Keep server handle open at all time"
Timo Kokkonen [Sun, 24 Jul 2016 11:12:37 +0000 (14:12 +0300)]
Revert "onewire_parser: Keep server handle open at all time"

This was not a very good workaround after all. It appears that on some
versions of ownet the client code leaks sockets even if it reuses the
server connection all the time. No point in having workaround like
this.

This reverts commit caedc46c0bfa22e0f8bdfd31132083383ca43994.

7 years agoonewire_parser: Keep server handle open at all time
Timo Kokkonen [Mon, 11 Jul 2016 11:56:48 +0000 (14:56 +0300)]
onewire_parser: Keep server handle open at all time

On libowfs 2.7 there appear to be a problem when releasing the client
resources. At least sockets are left open every now and then. There is
no such problem with 3.1 version.

To resolve the issue with older client library, keep the serve handle
open at all time. Release it only when there is a change with the
server address, which normally does not happen ever.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoonewire_parser: Avoid variable name collision
Timo Kokkonen [Mon, 11 Jul 2016 11:53:34 +0000 (14:53 +0300)]
onewire_parser: Avoid variable name collision

Counter 'i' is already used by the outer while loop. Re-declaring the
varialbe would not be a problem unless we had also the print below
that expects to use the variable from the outer while loop.

Rename the inner variable to avoid conflict.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agonetstat_parser: Fix file descriptor leak
Timo Kokkonen [Mon, 11 Jul 2016 04:10:26 +0000 (07:10 +0300)]
netstat_parser: Fix file descriptor leak

Once data is read, close the descriptor to prevent a leak.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoprocess: Trivial typo fix
Timo Kokkonen [Sun, 10 Jul 2016 06:29:44 +0000 (09:29 +0300)]
process: Trivial typo fix

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agodebug: Remove pid number from debug prints
Timo Kokkonen [Sun, 10 Jul 2016 06:28:34 +0000 (09:28 +0300)]
debug: Remove pid number from debug prints

Everything happens now in the same pid name space. Thread numbers
change, but thread names are more descriptive than numbers.

Remove the pid number and put the thread name inside the bracets.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoconfig: Fix confusion between pre_draw_cmd and post_draw_cmd
Timo Kokkonen [Sat, 9 Jul 2016 18:28:04 +0000 (21:28 +0300)]
config: Fix confusion between pre_draw_cmd and post_draw_cmd

When specifying post_draw_cmd on the config, it was interpreted as
predraw_cmd instead. Fix the incorrect behavior..

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agorrdtool: queue post_draw_cmd to be after images
Timo Kokkonen [Sat, 9 Jul 2016 18:10:04 +0000 (21:10 +0300)]
rrdtool: queue post_draw_cmd to be after images

The purpose of the post_draw_cmd is to execute something after the
rrdtool has drawn the images. Right now it executes the command
actually before drawing the images, as the command gets executed from
the high priority work that queued the image drawings.

This is not what we want. Therefore queue the post_draw_cmd to the
same low priority queue where the images are put. This guarantees that
the command does not begin too soon. On uniprocessors it is also
guaranteed that the command does not start executing before all of the
images are completed.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agorrdtool.c: Suppress compiler warnings with a cast
Timo Kokkonen [Sat, 9 Jul 2016 18:02:45 +0000 (21:02 +0300)]
rrdtool.c: Suppress compiler warnings with a cast

Add a typedef that can be used to cast function pointers for
queue_work().

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoprocess: Handle threads dynamically
Timo Kokkonen [Sat, 9 Jul 2016 17:18:13 +0000 (20:18 +0300)]
process: Handle threads dynamically

Instead of hard coding thread number on start up, handle them
dynamically as needed.

The max_jobs variable determines how many workers there may be
running. However, there are also high priority works that should be
executed even though thread count is already maxed. Thus we start a
new worker whenever a high priority work is queued.

As soon as work is finished and there are no more work to do or there
are too many threads to do low priority work, threads will exit.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoprocess: Remove fork based concurrenct management
Timo Kokkonen [Sat, 9 Jul 2016 14:47:30 +0000 (17:47 +0300)]
process: Remove fork based concurrenct management

The thread based concurrency system replaces the fork based
system. Remove all deprecated code out of the way.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agorun_work_on_queue: Remove excess debug print
Timo Kokkonen [Sat, 9 Jul 2016 11:15:06 +0000 (14:15 +0300)]
run_work_on_queue: Remove excess debug print

If the thread goes to sleep, the queues must be empty. No need to have
an explicit print for it.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoinit_job_control: Suppress compiler warning
Timo Kokkonen [Sat, 9 Jul 2016 11:12:54 +0000 (14:12 +0300)]
init_job_control: Suppress compiler warning

On 64 bit arch casting an int to (void *) causes a warning about
different word sizes. Use long int so that the variables have same
length.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoprocess: Remove signal handler completely
Timo Kokkonen [Sat, 9 Jul 2016 11:09:40 +0000 (14:09 +0300)]
process: Remove signal handler completely

There is no need for this at all any more. This was only used for
reaping the childs on the fork based concurrency management. Now that
threads are doing forking on the same namespace, threads that are
expecting signals might get confused when the main thread handles the
sigchld signal on behalf of the thread. Remove the handler completely
to avoid any confusion.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agodo_rrdtool_update_data: Initialize data buffer
Timo Kokkonen [Sat, 9 Jul 2016 10:22:28 +0000 (13:22 +0300)]
do_rrdtool_update_data: Initialize data buffer

Make sure the data buffer is zeroed completely before use. This
silences a walgrind warning of uninitialzed data usage.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agorrdtool: Remove unused variables
Timo Kokkonen [Sat, 9 Jul 2016 10:21:15 +0000 (13:21 +0300)]
rrdtool: Remove unused variables

These are leftovers from making the run() function synchronous.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agorrdtool_draw_image: Remove excess strlen() call
Timo Kokkonen [Sat, 9 Jul 2016 10:19:02 +0000 (13:19 +0300)]
rrdtool_draw_image: Remove excess strlen() call

strncat is already good enough ensuring target buffer will not
overflow. There is no need to use strlen at all.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agobuilt_in_parsers: Strenghten string handling
Timo Kokkonen [Sat, 9 Jul 2016 10:13:33 +0000 (13:13 +0300)]
built_in_parsers: Strenghten string handling

Replace all hard coded string lengths with sizeof(). Make sure data is
null terminated on script_parser().

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoMerge branch 'master' of /home/git/rrdd
Timo Kokkonen [Sat, 9 Jul 2016 07:05:36 +0000 (10:05 +0300)]
Merge branch 'master' of /home/git/rrdd

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoprocess: Make run() execute synchronously
Timo Kokkonen [Sat, 9 Jul 2016 06:50:07 +0000 (09:50 +0300)]
process: Make run() execute synchronously

Currently there are no need for running the process asynchronously on
background, so we might just make it run synchronously instead. This
simplifies the calling convention and also removes completely the need
to fork and possibly race in glibc functions.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoConvert rrdtool to use work queues instead of forks
Timo Kokkonen [Sat, 9 Jul 2016 06:44:51 +0000 (09:44 +0300)]
Convert rrdtool to use work queues instead of forks

Switch to the work queue model. Change is somewhat trivial. The
database update timestamp update is now done before the actual
update. We don't have a mean to distinguis from the fact that we have
initiated an update but not done it yet, so we mark it as "done" and
then queue the update. Without this change the main thread will keep
on queueing the update indefinitely as the worker thread takes too
long to actually mark the update as done.

To ensure the queues work properly, we also need to disable sigchld
handler from the process controller so that it does not get confused
when threads are reaping the childs them selves. This is different
from the previous model where each process required to handle their
own child reaping after fork(). Now we are sharing the signals with
the parent. This is a major simplification on how this works.

The magic sleep on job control init can be removed as well as there
are less forks going on now.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoprocess.c: Introduce work queues
Timo Kokkonen [Fri, 8 Jul 2016 19:44:39 +0000 (22:44 +0300)]
process.c: Introduce work queues

Work queues are a way to execute function calls asynchronously. Each
work is placed on a fifo queue where worker threads pick them up one
by one.

Priority levels are also supported, right now two levels are
available. All high priority works are executed before workers pick up
low priority works.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agodebug: Print thread name on debug prints
Timo Kokkonen [Fri, 8 Jul 2016 19:17:09 +0000 (22:17 +0300)]
debug: Print thread name on debug prints

Many different threads might be calling the same functions
concurrently. Add the name of the thread so that it becomes more
obvious which thread is emitting the given print.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoprocess: Add debug wrappers for pthread mutex operations
Timo Kokkonen [Fri, 8 Jul 2016 19:42:42 +0000 (22:42 +0300)]
process: Add debug wrappers for pthread mutex operations

This is the beginning of the work to convert the concurrency model
from fork-bomb based model to pthreads.

To get started, add a wrapper functions to handle locking. Namely,
these wrappers will log where the lock was acquired and will print out
who is holding it in case of contention.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
7 years agoprocess.c: Trivial white space cleanup
Timo Kokkonen [Fri, 8 Jul 2016 09:39:30 +0000 (12:39 +0300)]
process.c: Trivial white space cleanup

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
9 years agoprocess: run: Fix bug with multi-line prints
Timo Kokkonen [Tue, 28 Oct 2014 19:25:40 +0000 (21:25 +0200)]
process: run: Fix bug with multi-line prints

Once newlines are replaces with NULLs for printing, we must start the
next line after the NULL. Without this all extra printout lines are
zero in length.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
9 years agorrdtool: Add support for post_draw_cmd
Timo Kokkonen [Tue, 28 Oct 2014 19:16:21 +0000 (21:16 +0200)]
rrdtool: Add support for post_draw_cmd

Just like pre_draw_cmd, post_draw_cmd is a command that gets to be
executed after graphs are drawn. This is useful for example
transferring generated graphs into final location once rendering is
complete.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
9 years agoMerge remote-tracking branch 'origin/master'
Timo Kokkonen [Sun, 26 Oct 2014 15:35:34 +0000 (17:35 +0200)]
Merge remote-tracking branch 'origin/master'

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
9 years agorrdtool.c: Null terminate process argument list in add_arg
Timo Kokkonen [Sun, 26 Oct 2014 15:12:34 +0000 (17:12 +0200)]
rrdtool.c: Null terminate process argument list in add_arg

add_arg macro was not null teriminating argument list. Null
termination was left as an responsibility for the caller. This is
error prone as this requirement is not clear.

Add null termination in the add_arg macro so that caller does not need
to care about it.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
9 years agoprocess.c: Reduce maximum number of parallel jobs on UP machines
Timo Kokkonen [Tue, 9 Sep 2014 19:17:37 +0000 (22:17 +0300)]
process.c: Reduce maximum number of parallel jobs on UP machines

We generally don't see sinlge-cpu systems any more in other than
embedded devices, where chances of being very low in RAM is a very
real possibility. If the maximum number of parallel jobs is too large
there, is is quite possible that we run out of memory on such systems.

Reducing the number of jobs makes such devies much less likely to
exceed their memory capacity.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
9 years agoonewire_parser: Make sensor readin more robust on noisy 1-wire networks
Timo Kokkonen [Wed, 20 Aug 2014 19:07:05 +0000 (22:07 +0300)]
onewire_parser: Make sensor readin more robust on noisy 1-wire networks

On noisy environment there may be transient read failures with some
1-wire sensors. The sensors might "come and go" and also read results
might fail with "85 degree results".

Try to work around the issue by retrying a sensor read with uncached
data. This helps in cases where there was a error during 1-wire scan
and some sensors were not detected. This also helps when sensor
responds but reading the result produces "85" degree result.

Reading should be significantly more reliable with this change.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoAdd support for data logging
Timo Kokkonen [Sun, 6 Jan 2013 13:49:14 +0000 (15:49 +0200)]
Add support for data logging

Add new configuration parameters "logfile" and
"logfile_timestamp_fmt". Both of them are fed through strftime. The
first one is used for creating log file name, the second one is the
time stamp format in the beginning of each line.

Neither of the options are mandatory. If no file name is given, no
logging will be done. If no time stamp format is given, default of
"%Y.%m.%d %H:%M " is used.

Each line in the log file contains all the data elements given to
rrdtool during updating the database. The format is altered
slightly. The beginning of the line has got the time stamp, the
beginning "N:" part is removed and all ':' characters are replaced
with white space. Each entry is padded up to 12 characters with white
space in order to make the log file entries nicely human readable.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoRemove excess debug prints from default trace level
Timo Kokkonen [Fri, 30 Nov 2012 16:49:50 +0000 (18:49 +0200)]
Remove excess debug prints from default trace level

Now that we have debug print macro, move some of the most chatty
messages to the debug level from cluttering normal output.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoUser arguments: Add support for adjusting tracing level
Timo Kokkonen [Fri, 30 Nov 2012 16:47:03 +0000 (18:47 +0200)]
User arguments: Add support for adjusting tracing level

--verbose or -v increase verbosity
--quiet or -q decreases verbosity

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agodebug: Improve debugging macros
Timo Kokkonen [Fri, 30 Nov 2012 16:34:54 +0000 (18:34 +0200)]
debug: Improve debugging macros

Define different debug levels in one enum list instead of hard coding
with magic numbers.

Add two new debugging macros, one intended for warning messages and
another for pure debugging messages.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoMakefile: Adjust default targets
Timo Kokkonen [Fri, 30 Nov 2012 16:13:53 +0000 (18:13 +0200)]
Makefile: Adjust default targets

The "all" target will now build all parsers in addition to the main
executable. The "default" target builds only the main executable, thus
default setup will not have libownet build requirement.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agodebug: Add support for log files
Timo Kokkonen [Fri, 30 Nov 2012 16:11:01 +0000 (18:11 +0200)]
debug: Add support for log files

A new command line argument --logfile or -l is now supported for
logging purposes.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoMakefile: Fix typo in object list
Timo Kokkonen [Tue, 20 Nov 2012 20:08:07 +0000 (22:08 +0200)]
Makefile: Fix typo in object list

The ONEWIRE_PARSER_OBJS was written incorrectly. This causes ALL_OBJS
list to miss the parser object, which in turn causes the dependency
file to be missing from the ALL_DEBS list. That was causing make to
not detect that onewire_parser.c depends on version.h, and not rebuild
the library when version.h was changed.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoplugins: Add version checking
Timo Kokkonen [Tue, 20 Nov 2012 19:16:01 +0000 (21:16 +0200)]
plugins: Add version checking

Ensure that plugin is always built from the same version as the main
rrdd executable. If the version numbers don't match, don't load the
plugin.

This will ensure there are no strange bugs that appear when plugin
code is not built against the same source as the main executable.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoAdd automatic versioning and compiler checks
Timo Kokkonen [Tue, 20 Nov 2012 16:32:28 +0000 (18:32 +0200)]
Add automatic versioning and compiler checks

Generate a version string from the git HEAD commit. This makes it
possible to distinguish different versions of rrdd from each others.

Also add compiler string check. If compiler changes, rebuild
everything.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoonewire_parser: Convert to a plugin
Timo Kokkonen [Mon, 19 Nov 2012 20:12:09 +0000 (22:12 +0200)]
onewire_parser: Convert to a plugin

Onewire parser is the only piece of code here that depends on libownet
and requires linking against it. This is cumbersome whenever we wish
to build rrdd and we are not interested in having support for onewire
at all.

Converting the parser to a plugin solves the issue: We can now build
main rrdd without libownet dependency. Even if we have built the
onewire parser, we don't need to load it unless we are actually using
it.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoparser: Try loading a parser from a plugin in case no parser is found
Timo Kokkonen [Mon, 19 Nov 2012 19:59:00 +0000 (21:59 +0200)]
parser: Try loading a parser from a plugin in case no parser is found

When a parser is queried and one is not found within the ones that we
have already registered, try loading a plugin with that name. If
parser plugins are available, the parser might be available after the
plugin has been loaded.

The project is now fully compatible with having parsers as plugins.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoplugin_manager: Load parser plugins by name
Timo Kokkonen [Mon, 19 Nov 2012 19:45:39 +0000 (21:45 +0200)]
plugin_manager: Load parser plugins by name

A parser plugin is a plugin that has name "%s_parser.so", where "%s"
is the name of the parser. Implement a function that will try to find
a parser plugin by a name. If we can't find such plugin from the
global library path, try some other places as well, such as current
working directory and executable path.

In order to know the executable path, the plugin manager needs to be
initialized with the executable path. We are now doing it in the
beginning of the main function.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoUpdate .gitignore
Timo Kokkonen [Mon, 19 Nov 2012 19:43:30 +0000 (21:43 +0200)]
Update .gitignore

Add some entries that clutter the working tree often

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agomain.c: Consider default argument as a config file
Timo Kokkonen [Mon, 19 Nov 2012 18:44:06 +0000 (20:44 +0200)]
main.c: Consider default argument as a config file

If one does not specify any option, just gives an argument, it is a
good assumption that one is giving a config file.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoParsers: Implement framework for registering and querying parsers
Timo Kokkonen [Mon, 19 Nov 2012 18:43:52 +0000 (20:43 +0200)]
Parsers: Implement framework for registering and querying parsers

This framework can be used to register parsers and get parsers by a
string name. This allows all need for hard coding string and parser
function names together.

All existing parsers are converted to use the new framework.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoRemove database.h
Timo Kokkonen [Mon, 19 Nov 2012 16:48:38 +0000 (18:48 +0200)]
Remove database.h

Instead of having a database built in the software, have one being
provided with a config file instead. Keeping the database header file
is becoming a maintenance burden.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoAdd utils.h
Timo Kokkonen [Mon, 19 Nov 2012 16:40:29 +0000 (18:40 +0200)]
Add utils.h

Collect all random utilities in one header file available to all
users.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoIntroduce plugin manager
Timo Kokkonen [Mon, 19 Nov 2012 15:31:18 +0000 (17:31 +0200)]
Introduce plugin manager

Plugin manager can load plugins at run time from libraries. It expects
the plugin to contain one symbol, which contains plugin_info structure
defined in plugin.h file. The .init function is executed from within
the structure.

Add -rdynamic compiler flag in order to make the existing symbols
become visible to the dynamically loaded libraries.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agorrdtool: Add pre_draw_cmd
Timo Kokkonen [Sat, 10 Nov 2012 11:35:29 +0000 (13:35 +0200)]
rrdtool: Add pre_draw_cmd

This is a configurable command that can be executed before drawing
images.

Right now only "shell" command is supported. This takes a set of
string arguments that are executed via execv.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>