Code

sysdb.git
11 years agoutils error: Added module for error reporting.
Sebastian Harl [Sun, 10 Mar 2013 19:24:41 +0000 (20:24 +0100)]
utils error: Added module for error reporting.

This module will transparently store error information for each thread (similar
to errno). Support functions to store and retrieve error messages are available
on top of that. Once the error message has been passed to SysDB, it will log
the entire message. Currently, only printing to the standard error channel are
available.

11 years agoRenamed sysdbd.conf to sysdbd.conf.sample.
Sebastian Harl [Sun, 10 Mar 2013 18:37:06 +0000 (19:37 +0100)]
Renamed sysdbd.conf to sysdbd.conf.sample.

Also, unconditionally install that file; the user is expected to not change the
.sample file but rather use her own custom sysdbd.conf (there is no generic
config file anyway that could be shipped and enabled by default).

11 years agosysdbd.conf: Added sample configuration for each plugin.
Sebastian Harl [Sun, 10 Mar 2013 18:31:16 +0000 (19:31 +0100)]
sysdbd.conf: Added sample configuration for each plugin.

11 years agoMerged branch 'master' of git://git.tokkee.org/sysdb.git.
Sebastian Harl [Tue, 5 Mar 2013 01:11:13 +0000 (02:11 +0100)]
Merged branch 'master' of git://git.tokkee.org/sysdb.git.

11 years agoREADME: Added a note about flex/bison.
Sebastian Harl [Mon, 4 Mar 2013 23:06:22 +0000 (00:06 +0100)]
README: Added a note about flex/bison.

11 years agoconfigure: Also check for xmlto (in addition to xsltproc).
Sebastian Harl [Mon, 4 Mar 2013 18:05:47 +0000 (19:05 +0100)]
configure: Also check for xmlto (in addition to xsltproc).

This is also needed by the asciidoc tool-chain (in our situation?).

11 years agoconfigure: Don't use -Wunreachable-code.
Sebastian Harl [Mon, 4 Mar 2013 17:55:03 +0000 (18:55 +0100)]
configure: Don't use -Wunreachable-code.

This seems to cause errors with some versions of GCC when using assertions
that (after optimization, inlining, and code-analysis) will never be true.

11 years agobackends, daemon: Don't shadow global 'socket' and 'daemon' symbols.
Sebastian Harl [Mon, 4 Mar 2013 16:27:31 +0000 (17:27 +0100)]
backends, daemon: Don't shadow global 'socket' and 'daemon' symbols.

11 years agostore, llist: Don't shadow the global symbol 'clone'.
Sebastian Harl [Mon, 4 Mar 2013 16:23:59 +0000 (17:23 +0100)]
store, llist: Don't shadow the global symbol 'clone'.

11 years agoconfigure: Improved the check for disabled puppet-storeconfigs.
Sebastian Harl [Mon, 4 Mar 2013 15:52:36 +0000 (16:52 +0100)]
configure: Improved the check for disabled puppet-storeconfigs.

11 years agosdb_plugin.m4: Provide more details if a plugin is disabled by default.
Sebastian Harl [Mon, 4 Mar 2013 15:51:26 +0000 (16:51 +0100)]
sdb_plugin.m4: Provide more details if a plugin is disabled by default.

The default value passed to AC_SDB_PLUGIN might contain additional information
about why the plugin has been disabled by default. This information should be
forwarded to the user.

11 years agoconfigure: Don't pre-set enable_<plugin> variables.
Sebastian Harl [Mon, 4 Mar 2013 15:49:59 +0000 (16:49 +0100)]
configure: Don't pre-set enable_<plugin> variables.

This would cause AC_SDB_PLUGIN to assume that the respective --enable-<plugin>
option was given on the command-line and, thus, behave unexpected when this is
not the case.

11 years agopuppet-storeconfigs backend: Check database connection in collect callback.
Sebastian Harl [Wed, 20 Feb 2013 21:52:38 +0000 (22:52 +0100)]
puppet-storeconfigs backend: Check database connection in collect callback.

11 years agoutils dbi: Added sdb_dbi_client_check_conn().
Sebastian Harl [Wed, 20 Feb 2013 21:50:15 +0000 (22:50 +0100)]
utils dbi: Added sdb_dbi_client_check_conn().

This functions checks the database connection and tries to reconnect if there
was a problem. The return code determines if the connection was usable
afterwards.

11 years agoutils dbi: Avoid segfault when executing queries when not connected.
Sebastian Harl [Tue, 19 Feb 2013 17:39:46 +0000 (18:39 +0100)]
utils dbi: Avoid segfault when executing queries when not connected.

Apparently, the libdbi functions don't check for that condition.

11 years agoRenamed the project to SysDB (System DataBase).
Sebastian Harl [Wed, 2 Jan 2013 21:10:00 +0000 (22:10 +0100)]
Renamed the project to SysDB (System DataBase).

This name more closely resembles the actual intent / goal of the project.

The prefix for defines / function / etc. has been changed to sdb_.

11 years agoAdded missing daemon/config.h.
Sebastian Harl [Wed, 2 Jan 2013 21:07:14 +0000 (22:07 +0100)]
Added missing daemon/config.h.

11 years agostore: Fixed host lock handling.
Sebastian Harl [Wed, 2 Jan 2013 09:18:01 +0000 (10:18 +0100)]
store: Fixed host lock handling.

Release the lock before returning in error conditions.

11 years agoPuppet storeconfigs backend: Query facts and store them as host attributes.
Sebastian Harl [Mon, 17 Dec 2012 10:42:02 +0000 (11:42 +0100)]
Puppet storeconfigs backend: Query facts and store them as host attributes.

11 years agostore: Added support for host attributes.
Sebastian Harl [Mon, 17 Dec 2012 10:39:48 +0000 (11:39 +0100)]
store: Added support for host attributes.

Attributes are a list of key / value pairs assigned to a host object. They may
be used to store arbitrary properties, settings, or other characteristics of a
host.

Later on, this information will also be used to filter, group, or
hierarchically order hosts.

11 years agostore: Print the right update timestamp when dumping services.
Sebastian Harl [Mon, 17 Dec 2012 10:37:56 +0000 (11:37 +0100)]
store: Print the right update timestamp when dumping services.

11 years agoMK Livestatus backend: Added support for querying services.
Sebastian Harl [Thu, 13 Dec 2012 13:15:12 +0000 (14:15 +0100)]
MK Livestatus backend: Added support for querying services.

This is done using the livestatus 'GET services' command.

11 years agoMK Livestatus backend: Converted to use sc_unixsock_client_process_lines().
Sebastian Harl [Thu, 13 Dec 2012 12:57:38 +0000 (13:57 +0100)]
MK Livestatus backend: Converted to use sc_unixsock_client_process_lines().

This removes the need to do the parsing of returned lines in the backend code.

11 years agocollectd backend: Converted to use sc_unixsock_client_process_lines().
Sebastian Harl [Thu, 13 Dec 2012 12:37:45 +0000 (13:37 +0100)]
collectd backend: Converted to use sc_unixsock_client_process_lines().

This removes the need to do the parsing of returned lines in the backend code.

11 years agoobject.h: Added SC_OBJECT_WRAPPER_STATIC().
Sebastian Harl [Thu, 13 Dec 2012 12:37:14 +0000 (13:37 +0100)]
object.h: Added SC_OBJECT_WRAPPER_STATIC().

This may be used to initialize static sc_object_wrapper_t objects.

11 years agostore: Changed various parameters to 'const char *'.
Sebastian Harl [Thu, 13 Dec 2012 12:35:34 +0000 (13:35 +0100)]
store: Changed various parameters to 'const char *'.

None of these parameters will be modified, so all to pass in constant strings.

11 years agoutils dbi + unixsock: Pass user-data object to data processing callbacks.
Sebastian Harl [Wed, 12 Dec 2012 05:15:11 +0000 (06:15 +0100)]
utils dbi + unixsock: Pass user-data object to data processing callbacks.

This may be used to access, for example, state information throughout each
call.

11 years agoutils unixsock: Added sc_unixsock_client_process_lines().
Sebastian Harl [Tue, 11 Dec 2012 18:43:26 +0000 (19:43 +0100)]
utils unixsock: Added sc_unixsock_client_process_lines().

This function may be used to process data returned from the socket line by
line. The function will split each line into columns. The data-types of each
column may be specified by the caller.

This is similar to the DBI query abstraction function (sc_dbi_exec_query()) in
that in takes care of all the annoying data parsing and conversion stuff.

11 years agoutils data: Added module providing a data-type to store arbitrary backend data
Sebastian Harl [Tue, 11 Dec 2012 18:40:04 +0000 (19:40 +0100)]
utils data: Added module providing a data-type to store arbitrary backend data

This has been ripped out of the DBI module to make the functionality available
to other modules as well through a uniform interface.

11 years agosyscollectord: Include extra version information in startup/shutdown messages.
Sebastian Harl [Tue, 11 Dec 2012 10:03:16 +0000 (11:03 +0100)]
syscollectord: Include extra version information in startup/shutdown messages.

11 years agoAdded initial version of the MK Livestatus backend.
Sebastian Harl [Tue, 11 Dec 2012 10:00:11 +0000 (11:00 +0100)]
Added initial version of the MK Livestatus backend.

This backend uses the MK Livestatus interface available for Nagios, Icinga,
Shinken and possibly other software, to retrieve host information from those
monitoring systems.

11 years agoutils unixsock: Added wrappers for clearerr(), feof(), and ferror().
Sebastian Harl [Tue, 11 Dec 2012 09:58:13 +0000 (10:58 +0100)]
utils unixsock: Added wrappers for clearerr(), feof(), and ferror().

11 years agoutils unixsock: Added sc_unixsock_client_shutdown().
Sebastian Harl [Tue, 11 Dec 2012 09:55:36 +0000 (10:55 +0100)]
utils unixsock: Added sc_unixsock_client_shutdown().

This function is a wrapper around shutdown(3). After shutting down send /
receive operations, the client will automatically re-connect on the next
send() / recv() call.

11 years agostore: Return a positive value when to-be-stored host/service is too old.
Sebastian Harl [Tue, 11 Dec 2012 09:43:42 +0000 (10:43 +0100)]
store: Return a positive value when to-be-stored host/service is too old.

This allows to let the caller decide what to do in that case.

11 years agostore: Don't return an error if an updated host is too old.
Sebastian Harl [Tue, 11 Dec 2012 08:42:23 +0000 (09:42 +0100)]
store: Don't return an error if an updated host is too old.

This may happen, if multiple backends report the same host (which is perfectly
fine and the desired behavior in fact).

11 years agoutils unixsock: Fixed EOF handling in recv().
Sebastian Harl [Tue, 11 Dec 2012 08:06:57 +0000 (09:06 +0100)]
utils unixsock: Fixed EOF handling in recv().

11 years agoAdded initial version of the puppet-storeconfigs backend.
Sebastian Harl [Mon, 10 Dec 2012 14:41:45 +0000 (15:41 +0100)]
Added initial version of the puppet-storeconfigs backend.

This backend currently retrieves host information from Puppet by querying its
Store-Configs database using DBI.

11 years agosc_plugin.m4: Added support for dashes in plugin names to AC_SC_PLUGIN().
Sebastian Harl [Mon, 10 Dec 2012 14:40:38 +0000 (15:40 +0100)]
sc_plugin.m4: Added support for dashes in plugin names to AC_SC_PLUGIN().

11 years agoutils dbi: Added initial version.
Sebastian Harl [Mon, 10 Dec 2012 14:37:48 +0000 (15:37 +0100)]
utils dbi: Added initial version.

This module provides helper functions for using libdbi. Currently, data types
and functions for managing connection options, a database connection as well
as a generic query helper are available.

The query helper (sc_dbi_exec_query()) uses a specified callback function to
handle each row as returned from the SQL query. A custom data-type (based on
the libdbi data-types) is used to pass the query results to the handler
callback.

11 years agoInitial commit. sysdb-0.0.0
Sebastian Harl [Wed, 5 Dec 2012 15:10:48 +0000 (16:10 +0100)]
Initial commit.

This is the initial version of 'syscollector', a system management / inventory
collection service. The current version provides a configurable plugin
infrastructure to query host / service objects.

The system is made up of the following components:

 - libsyscollector: the library providing the core functionality to manage
   plugins and the data store

    * core/object: base "class" for objects being stored in any part of the
      library; an object contains information about a reference count and the
      actual data being stored (in derived "classes"); it may be used to ease
      memory management when using instances in different parts of the
      software

    * core/plugin: infrastructure for registering and calling plugin
      callbacks; each registered plugin has its own context which stores
      information that should be available to different parts of the software
      without having the plugin to care much about it; for now, configuration,
      init, shutdown and collector (backend) callbacks are supported

    * core/store: implementation of the system object store; currently, host
      and service entries are supported; each host includes a list of services
      assigned to it; the store objects are derived from the core object
      implementation

    * utils/llist: a linked list implementation, currently supporting sorted
      insertions, searching and shifting objects and iterators; the list
      stores core object instances

    * utils/string: collection of string utilities; currently a wrapper around
      strerror_r() is available only

    * utils/time: implementation of a custom time type which is a single
      integer value storing the time since the epoch in nanoseconds
      resolution; this is provided for simplified time calculations and
      comparisons

    * utils/unixsock: helper functions to connect to and communicate with a
      UNIX domain socket

 - backends: plugins implementing collector callbacks

    * collectd: this backend retrieves host and service information from
      collectd, the system statistics collection daemon, through its unixsock
      interface

 - daemon: 'syscollectord' is a daemon based on libsyscollector which
   periodically queries all backends

 - liboconfig: the configuration parsing library used by collectd; this is
   used by 'syscollectord' for parsing its configuration and it's used by
   libsyscollector to pass on configuration to the plugins