Merge branch 'collectd-4.2'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Wed, 23 Jan 2008 13:54:54 +0000 (14:54 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Wed, 23 Jan 2008 13:54:54 +0000 (14:54 +0100)
1  2 
src/collectd-unixsock.pod
src/common.h

@@@ -77,7 -77,11 +77,11 @@@ daemon which will dispatch it to all it
  An I<Identifier> is of the form
  C<I<host>B</>I<plugin>B<->I<instance>B</>I<type>B<->I<instance>> with both
  I<instance>-parts being optional. If they're omitted the hyphen must be
- omitted, too.
+ omitted, too. I<plugin> and each I<instance>-part may be chosen freely as long
+ as the tuple (plugin, plugin instance, type instance) uniquely identifies the
+ plugin within collectd. I<type> identifies the type and number of values
+ (i.E<nbsp>e. data-set) passed to collectd. A large list of predefined
+ data-sets is available in the B<types.db> file.
  
  The I<OptionList> is an optional list of I<Options>, where each option if a
  key-value-pair. A list of currently understood options can be found below, all
@@@ -112,61 -116,6 +116,61 @@@ Example
    -> | PUTVAL testhost/interface/if_octets-test0 interval=10 1179574444:123:456
    <- | 0 Success
  
 +=item B<PUTNOTIF> [I<OptionList>] B<message=>I<Message>
 +
 +Submits a notification to the daemon which will then dispatch it to all plugins
 +which have registered for receiving notifications. 
 +
 +The B<PUTNOTIF> if followed by a list of options which further describe the
 +notification. The B<message> option is special in that it will consume the rest
 +of the line as its value. The B<message>, B<severity>, and B<time> options are
 +mandatory.
 +
 +Valid options are:
 +
 +=over 4
 +
 +=item B<message=>I<Message> (B<REQUIRED>)
 +
 +Sets the message of the notification. This is the message that will be made
 +accessible to the user, so it should contain some useful information. This
 +option must be the last option because the rest of the line will be its value,
 +even if there are spaces and equal-signs following it! This option is
 +mandatory.
 +
 +=item B<severity=failure>|B<warning>|B<okay> (B<REQUIRED>)
 +
 +Sets the severity of the notification. This option is mandatory.
 +
 +=item B<time=>I<Time> (B<REQUIRED>)
 +
 +Sets the time of the notification. The time is given as "epoch", i.E<nbsp>e. as
 +seconds since January 1st, 1970, 00:00:00. This option is mandatory.
 +
 +=item B<host=>I<Hostname>
 +
 +=item B<plugin=>I<Plugin>
 +
 +=item B<plugin_instance=>I<Plugin-Instance>
 +
 +=item B<type=>I<Type>
 +
 +=item B<type_instance=>I<Type-Instance>
 +
 +These "associative" options establish a relation between this notification and
 +collected performance data. This connection is purely informal, i.E<nbsp>e. the
 +daemon itself doesn't do anything with this information. However, websites or
 +GUIs may use this information to place notifications near the affected graph or
 +table. All the options are optional, but B<plugin_instance> without B<plugin>
 +or B<type_instance> without B<type> doesn't make much sense and should be
 +avoided.
 +
 +=back
 +
 +Example:
 +  -> | PUTNOTIF type=temperature severity=warning time=1201094702 message=The roof is on fire!
 +  <- | 0 Success
 +
  =back
  
  =head2 Identifiers
diff --combined src/common.h
@@@ -1,6 -1,6 +1,6 @@@
  /**
   * collectd - src/common.h
 - * Copyright (C) 2005-2007  Florian octo Forster
 + * Copyright (C) 2005-2008  Florian octo Forster
   *
   * This program is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License as published by the
@@@ -48,17 -48,17 +48,17 @@@ char *sstrerror (int errnum, char *buf
   *   sread
   *
   * DESCRIPTION
-  *   Reads exactly `n' bytes or failes. Syntax and other behavior is analogous
+  *   Reads exactly `n' bytes or fails. Syntax and other behavior is analogous
   *   to `read(2)'. If EOF is received the file descriptor is closed and an
   *   error is returned.
   *
   * PARAMETERS
   *   `fd'          File descriptor to write to.
   *   `buf'         Buffer that is to be written.
-  *   `count'       Numver of bytes in the buffer.
+  *   `count'       Number of bytes in the buffer.
   *
   * RETURN VALUE
-  *   Zero upon success or non-zero if an error occured. `errno' is set in this
+  *   Zero upon success or non-zero if an error occurred. `errno' is set in this
   *   case.
   */
  ssize_t sread (int fd, void *buf, size_t count);
   *   swrite
   *
   * DESCRIPTION
-  *   Writes exactly `n' bytes or failes. Syntax and other behavior is analogous
+  *   Writes exactly `n' bytes or fails. Syntax and other behavior is analogous
   *   to `write(2)'.
   *
   * PARAMETERS
   *   `fd'          File descriptor to write to.
   *   `buf'         Buffer that is to be written.
-  *   `count'       Numver of bytes in the buffer.
+  *   `count'       Number of bytes in the buffer.
   *
   * RETURN VALUE
-  *   Zero upon success or non-zero if an error occured. `errno' is set in this
+  *   Zero upon success or non-zero if an error occurred. `errno' is set in this
   *   case.
   */
  ssize_t swrite (int fd, const void *buf, size_t count);
@@@ -108,8 -108,8 +108,8 @@@ int strsplit (char *string, char **fiel
   *   strjoin
   *
   * DESCRIPTION
-  *   Joins together several parts of a string using `sep' as a seperator. This
-  *   is equipollent to the perl buildin `join'.
+  *   Joins together several parts of a string using `sep' as a separator. This
+  *   is equivalent to the Perl built-in `join'.
   *
   * PARAMETERS
   *   `dst'         Buffer where the result is stored.
   *
   * RETURN VALUE
   *   Returns the number of characters in `dst', NOT including the trailing
-  *   null-byte. If an error occured (empty array or `dst' too small) a value
+  *   null-byte. If an error occurred (empty array or `dst' too small) a value
   *   smaller than zero will be returned.
   */
  int strjoin (char *dst, size_t dst_len, char **fields, size_t fields_num, const char *sep);
@@@ -181,12 -181,4 +181,12 @@@ int getpwnam_r (const char *name, struc
                size_t buflen, struct passwd **pwbufp);
  #endif
  
 +int notification_init (notification_t *n, int severity, const char *message,
 +              const char *host,
 +              const char *plugin, const char *plugin_instance,
 +              const char *type, const char *type_instance);
 +#define NOTIFICATION_INIT_VL(n, vl, ds) \
 +      notification_init (n, NOTIF_FAILURE, NULL, \
 +                      (vl)->host, (vl)->plugin, (vl)->plugin_instance, \
 +                      (ds)->type, (vl)->type_instance)
  #endif /* COMMON_H */