- Initial author.
Sebastian "tokkee" Harl <sh at tokkee.org>
- - Bugfixed and enhancments in many places all around the project.
+ - Bugfixes and enhancments in many places all around the project.
- perl plugin.
- users plugin.
- vserver plugin.
#! /bin/sh
-if ! which lex > /dev/null 2>&1; then
- echo "WARNING: lex not found!" >&2
- echo "Make sure that you have a flex compatible tool available." >&2
-fi
+GLOBAL_ERROR_INDICATOR=0
-if ! which yacc > /dev/null 2>&1; then
- echo "WARNING: yacc not found!" >&2
- echo "Make sure that you have a GNU bison compatible tool available." >&2
-fi
+check_for_application ()
+{
+ for PROG in "$@"
+ do
+ if ! which "$PROG" >/dev/null 2>&1; then
+ cat >&2 <<EOF
+WARNING: \`$PROG' not found!
+ Please make sure that \`$PROG' is installed and is in one of the
+ directories listed in the PATH environment variable.
+EOF
+ GLOBAL_ERROR_INDICATOR=1
+ fi
+ done
+}
-libtoolize=libtoolize
+check_for_application lex yacc autoheader aclocal automake autoconf
-if which glibtoolize > /dev/null 2>&1; then
+# Actually we don't need the pkg-config executable, but we need the M4 macros.
+# We check for `pkg-config' here and hope that M4 macros will then be
+# available, too.
+check_for_application pkg-config
+
+libtoolize=""
+if which libtoolize >/dev/null 2>&1
+then
+ libtoolize=libtoolize
+else if which glibtoolize >/dev/null 2>&1
+then
libtoolize=glibtoolize
+else
+ cat >&2 <<EOF
+WARNING: Neither \`libtoolize' nor \`glibtoolize' have been found!
+ Please make sure that one of them is installed and is in one of the
+ directories listed in the PATH environment variable.
+EOF
+ GLOBAL_ERROR_INDICATOR=1
+fi; fi
+
+if test "$GLOBAL_ERROR_INDICATOR" != "0"
+then
+ exit 1
fi
set -x
'GPRINT:spam:LAST:%4.1lf Last',
'HRULE:0#000000'
],
+ memcached_command => ['-v', 'Commands',
+ 'DEF:avg={file}:value:AVERAGE',
+ 'DEF:min={file}:value:MIN',
+ 'DEF:max={file}:value:MAX',
+ "AREA:max#$HalfBlue",
+ "AREA:min#$Canvas",
+ "LINE1:avg#$FullBlue:Commands",
+ 'GPRINT:min:MIN:%5.1lf%s Min,',
+ 'GPRINT:avg:AVERAGE:%5.1lf Avg,',
+ 'GPRINT:max:MAX:%5.1lf Max,',
+ 'GPRINT:avg:LAST:%5.1lf Last\l'
+ ],
+ memcached_connections => ['-v', 'Connections',
+ 'DEF:avg={file}:value:AVERAGE',
+ 'DEF:min={file}:value:MIN',
+ 'DEF:max={file}:value:MAX',
+ "AREA:max#$HalfBlue",
+ "AREA:min#$Canvas",
+ "LINE1:avg#$FullBlue:Connections",
+ 'GPRINT:min:MIN:%4.1lf Min,',
+ 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
+ 'GPRINT:max:MAX:%4.1lf Max,',
+ 'GPRINT:avg:LAST:%4.1lf Last\l'
+ ],
+ memcached_items => ['-v', 'Items',
+ 'DEF:avg={file}:value:AVERAGE',
+ 'DEF:min={file}:value:MIN',
+ 'DEF:max={file}:value:MAX',
+ "AREA:max#$HalfBlue",
+ "AREA:min#$Canvas",
+ "LINE1:avg#$FullBlue:Items",
+ 'GPRINT:min:MIN:%4.1lf Min,',
+ 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
+ 'GPRINT:max:MAX:%4.1lf Max,',
+ 'GPRINT:avg:LAST:%4.1lf Last\l'
+ ],
+ memcached_octets => ['-v', 'Bits/s',
+ 'DEF:out_min={file}:tx:MIN',
+ 'DEF:out_avg={file}:tx:AVERAGE',
+ 'DEF:out_max={file}:tx:MAX',
+ 'DEF:inc_min={file}:rx:MIN',
+ 'DEF:inc_avg={file}:rx:AVERAGE',
+ 'DEF:inc_max={file}:rx:MAX',
+ 'CDEF:mytime=out_avg,TIME,TIME,IF',
+ 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
+ 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
+ 'CDEF:out_avg_sample=out_avg,UN,0,out_avg,IF,sample_len,*',
+ 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
+ 'CDEF:inc_avg_sample=inc_avg,UN,0,inc_avg,IF,sample_len,*',
+ 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
+ 'CDEF:out_bit_min=out_min,8,*',
+ 'CDEF:out_bit_avg=out_avg,8,*',
+ 'CDEF:out_bit_max=out_max,8,*',
+ 'CDEF:inc_bit_min=inc_min,8,*',
+ 'CDEF:inc_bit_avg=inc_avg,8,*',
+ 'CDEF:inc_bit_max=inc_max,8,*',
+ 'CDEF:overlap=out_bit_avg,inc_bit_avg,GT,inc_bit_avg,out_bit_avg,IF',
+ "AREA:out_bit_avg#$HalfGreen",
+ "AREA:inc_bit_avg#$HalfBlue",
+ "AREA:overlap#$HalfBlueGreen",
+ "LINE1:out_bit_avg#$FullGreen:Written",
+ 'GPRINT:out_bit_avg:AVERAGE:%5.1lf%s Avg,',
+ 'GPRINT:out_bit_max:MAX:%5.1lf%s Max,',
+ 'GPRINT:out_bit_avg:LAST:%5.1lf%s Last',
+ 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
+ "LINE1:inc_bit_avg#$FullBlue:Read ",
+ 'GPRINT:inc_bit_avg:AVERAGE:%5.1lf%s Avg,',
+ 'GPRINT:inc_bit_max:MAX:%5.1lf%s Max,',
+ 'GPRINT:inc_bit_avg:LAST:%5.1lf%s Last',
+ 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
+ ],
+ memcached_ops => ['-v', 'Ops',
+ 'DEF:avg={file}:value:AVERAGE',
+ 'DEF:min={file}:value:MIN',
+ 'DEF:max={file}:value:MAX',
+ "AREA:max#$HalfBlue",
+ "AREA:min#$Canvas",
+ "LINE1:avg#$FullBlue:Ops",
+ 'GPRINT:min:MIN:%4.1lf Min,',
+ 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
+ 'GPRINT:max:MAX:%4.1lf Max,',
+ 'GPRINT:avg:LAST:%4.1lf Last\l'
+ ],
memory => ['-b', '1024', '-v', 'Bytes',
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
GraphWidth 400
-UnixSockAddr "/var/run/collectd-unixsock"
+#UnixSockAddr "/var/run/collectd-unixsock"
+<Type apache_bytes>
+ DataSources count
+ DSName "count Bytes/s"
+ RRDTitle "Apache Traffic"
+ RRDVerticalLabel "Bytes/s"
+ RRDFormat "%5.1lf%s"
+ Color count 0000ff
+</Type>
+<Type apache_requests>
+ DataSources count
+ DSName "count Requests/s"
+ RRDTitle "Apache Traffic"
+ RRDVerticalLabel "Requests/s"
+ RRDFormat "%5.2lf"
+ Color count 00d000
+</Type>
<Type apache_scoreboard>
Module GenericStacked
DataSources count
DataSources read write
DSName "read Read "
DSName write Written
- RRDTitle "Disk Traffic ({plugin_instance})"
+ RRDTitle "Disk Traffic ({instance})"
RRDVerticalLabel "Bytes per second"
# RRDOptions ...
RRDFormat "%5.1lf%s"
DataSources read write
DSName "read Read "
DSName write Written
- RRDTitle "Disk Operations ({plugin_instance})"
+ RRDTitle "Disk Operations ({instance})"
RRDVerticalLabel "Operations per second"
# RRDOptions ...
RRDFormat "%5.1lf"
DataSources read write
DSName "read Read "
DSName write Written
- RRDTitle "Disk Merged Operations ({plugin_instance})"
+ RRDTitle "Disk Merged Operations ({instance})"
RRDVerticalLabel "Merged operations/s"
# RRDOptions ...
RRDFormat "%5.1lf"
DataSources read write
DSName "read Read "
DSName write Written
- RRDTitle "Disk time per operation ({plugin_instance})"
+ RRDTitle "Disk time per operation ({instance})"
RRDVerticalLabel "Avg. Time/Op"
# RRDOptions ...
RRDFormat "%5.1lf%ss"
Color buffered ffb000
Color used ff0000
</Type>
+<Type mysql_commands>
+ Module GenericStacked
+ DataSources value
+ RRDTitle "MySQL commands"
+ RRDVerticalLabel "Invocations"
+ RRDFormat "%6.2lf"
+
+ DSName admin_commands admin_commands
+ DSName alter_table alter_table
+ DSName begin begin
+ DSName change_db change_db
+ DSName check check
+ DSName commit commit
+ DSName create_db create_db
+ DSName create_table create_table
+ DSName delete delete
+ DSName drop_db drop_db
+ DSName drop_table drop_table
+ DSName flush flush
+ DSName grant grant
+ DSName insert insert
+ DSName insert_select insert_select
+ DSName lock_tables lock_tables
+ DSName optimize optimize
+ DSName rename_table rename_table
+ DSName replace replace
+ DSName revoke revoke
+ DSName select select
+ DSName set_option set_option
+ DSName show_create_table show_create_table
+ DSName show_databases show_databases
+ DSName show_fields show_fields
+ DSName show_keys show_keys
+ DSName show_master_status show_master_status
+ DSName show_processlist show_processlist
+ DSName show_slave_hosts show_slave_hosts
+ DSName show_status show_status
+ DSName show_tables show_tables
+ DSName show_triggers show_triggers
+ DSName show_variables show_variables
+ DSName unlock_tables unlock_tables
+ DSName update update
+ DSName update_multi update_multi
+
+ Order admin_commands alter_table begin change_db check commit create_db create_table delete drop_db drop_table flush grant insert insert_select lock_tables optimize rename_table replace revoke select set_option show_create_table show_databases show_fields show_keys show_master_status show_processlist show_slave_hosts show_status show_tables show_triggers show_variables unlock_tables update update_multi
+
+ Color admin_commands ff0000
+ Color alter_table ff002a
+ Color begin ff0055
+ Color change_db ff007f
+ Color check ff00aa
+ Color commit ff00d4
+ Color create_db ff00ff
+ Color create_table d400ff
+ Color delete aa00ff
+ Color drop_db 7f00ff
+ Color drop_table 5400ff
+ Color flush 2a00ff
+ Color grant 0000ff
+ Color insert 002aff
+ Color insert_select 0055ff
+ Color lock_tables 007fff
+ Color optimize 00a9ff
+ Color rename_table 00d4ff
+ Color replace 00ffff
+ Color revoke 00ffd4
+ Color select 00ffa9
+ Color set_option 00ff7f
+ Color show_create_table 00ff55
+ Color show_databases 00ff2a
+ Color show_fields 00ff00
+ Color show_keys 2aff00
+ Color show_master_status 54ff00
+ Color show_processlist 7fff00
+ Color show_slave_hosts aaff00
+ Color show_status d4ff00
+ Color show_tables ffff00
+ Color show_triggers ffd400
+ Color show_variables ffaa00
+ Color unlock_tables ff7f00
+ Color update ff5400
+ Color update_multi ff2a00
+</Type>
+<Type mysql_handler>
+ Module GenericStacked
+ DataSources value
+ RRDTitle "MySQL handler"
+ RRDVerticalLabel "Invocations"
+ RRDFormat "%6.2lf"
+ DSName commit commit
+ DSName delete delete
+ DSName read_first read_first
+ DSName read_key read_key
+ DSName read_next read_next
+ DSName read_prev read_prev
+ DSName read_rnd read_rnd
+ DSName read_rnd_next read_rnd_next
+ DSName update update
+ DSName write write
+ Order commit delete read_first read_key read_next read_prev read_rnd read_rnd_next update write
+ Color commit ff0000
+ Color delete ff0099
+ Color read_first cc00ff
+ Color read_key 3200ff
+ Color read_next 0065ff
+ Color read_prev 00ffff
+ Color read_rnd 00ff65
+ Color read_rnd_next 33ff00
+ Color update cbff00
+ Color write ff9800
+</Type>
+<Type mysql_octets>
+ Module GenericIO
+ DataSources rx tx
+ DSName rx RX
+ DSName tx TX
+ RRDTitle "MySQL Traffic"
+ RRDVerticalLabel "Bits per second"
+ RRDFormat "%5.1lf%s"
+ Scale 8
+</Type>
<Type percent>
DataSources percent
DSName percent Percent
=item B<Socket> I<Path>
Configures the path to the UNIX domain socket to be used when connecting to the
-daemon. By default C</var/run/pdns.controlsocket> will be used for an
-authoritative server and C</var/run/pdns_recursor.controlsocket> will be used
-for the recursor.
+daemon. By default C<${localstatedir}/run/pdns.controlsocket> will be used for
+an authoritative server and C<${localstatedir}/run/pdns_recursor.controlsocket>
+will be used for the recursor.
=back
will run serious performance problems. The B<CacheFlush> setting and the
internal update queue assert that collectd continues to work just fine even
under heavy load, but the system may become very unresponsive and slow. This is
-a problem especially if create graphs from the RRD files on the same machine,
-for example using the C<graph.cgi> script included in the
+a problem especially if you create graphs from the RRD files on the same
+machine, for example using the C<graph.cgi> script included in the
C<contrib/collection3/> directory.
This setting is designed for very large setups. Setting this option to a value
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
if (0 != perl_parse (aTHX_ xs_init, argc, argv, NULL)) {
- log_err ("init_pi: Unable to bootstrap Collectd.");
+ SV *err = get_sv ("@", 1);
+ log_err ("init_pi: Unable to bootstrap Collectd: %s",
+ SvPV_nolen (err));
perl_destruct (perl_threads->head->interp);
perl_free (perl_threads->head->interp);
if (0 < retvals) {
SV *tmp = POPs;
if (! SvTRUE (tmp))
- ret = -1;
+ ret = 1;
}
else
- ret = -1;
+ ret = 1;
PUTBACK;
FREETMPS;
static int perl_config (oconfig_item_t *ci)
{
+ int status = 0;
int i = 0;
dTHXa (NULL);
for (i = 0; i < ci->children_num; ++i) {
oconfig_item_t *c = ci->children + i;
+ int current_status;
if (NULL != perl_threads)
aTHX = PERL_GET_CONTEXT;
if (0 == strcasecmp (c->key, "LoadPlugin"))
- perl_config_loadplugin (aTHX_ c);
+ current_status = perl_config_loadplugin (aTHX_ c);
else if (0 == strcasecmp (c->key, "BaseName"))
- perl_config_basename (aTHX_ c);
+ current_status = perl_config_basename (aTHX_ c);
else if (0 == strcasecmp (c->key, "EnableDebugger"))
- perl_config_enabledebugger (aTHX_ c);
+ current_status = perl_config_enabledebugger (aTHX_ c);
else if (0 == strcasecmp (c->key, "IncludeDir"))
- perl_config_includedir (aTHX_ c);
+ current_status = perl_config_includedir (aTHX_ c);
else if (0 == strcasecmp (c->key, "Plugin"))
- perl_config_plugin (aTHX_ c);
+ current_status = perl_config_plugin (aTHX_ c);
else
log_warn ("Ignoring unknown config key \"%s\".", c->key);
+
+ /* fatal error - it's up to perl_config_* to clean up */
+ if (0 > current_status) {
+ log_err ("Configuration failed with a fatal error - "
+ "plugin disabled!");
+ return current_status;
+ }
+
+ status += current_status;
}
- return 0;
+ return status;
} /* static int perl_config (oconfig_item_t *) */
void module_register (void)
void plugin_log (int level, const char *format, ...)
{
- char msg[512];
+ char msg[1024];
va_list ap;
void (*callback) (int, const char *);
#endif
va_start (ap, format);
- vsnprintf (msg, 512, format, ap);
- msg[511] = '\0';
+ vsnprintf (msg, sizeof (msg), format, ap);
+ msg[sizeof (msg) - 1] = '\0';
va_end (ap);
le = llist_head (list_log);
#endif
#define FUNC_ERROR(func) do { char errbuf[1024]; ERROR ("powerdns plugin: %s failed: %s", func, sstrerror (errno, errbuf, sizeof (errbuf))); } while (0)
-#define SERVER_SOCKET "/var/run/pdns.controlsocket"
+#define SERVER_SOCKET LOCALSTATEDIR"/run/pdns.controlsocket"
#define SERVER_COMMAND "SHOW *"
-#define RECURSOR_SOCKET "/var/run/pdns_recursor.controlsocket"
+#define RECURSOR_SOCKET LOCALSTATEDIR"/run/pdns_recursor.controlsocket"
#define RECURSOR_COMMAND "get noerror-answers nxdomain-answers " \
"servfail-answers sys-msec user-msec qa-latency cache-entries cache-hits " \
"cache-misses questions"
if (vl->type == ASN_OCTET_STR)
{
- char *string;
char *endptr;
- string = (char *) vl->val.string;
endptr = NULL;
-
- if (string != NULL)
+ if (vl->val.string != NULL)
{
+ char string[64];
+ size_t string_length;
+
+ string_length = sizeof (string) - 1;
+ if (vl->val_len < string_length)
+ string_length = vl->val_len;
+
+ /* The strings we get from the Net-SNMP library may not be null
+ * terminated. That is why we're using `membpy' here and not `strcpy'.
+ * `string_length' is set to `vl->val_len' which holds the length of the
+ * string. -octo */
+ memcpy (string, vl->val.string, string_length);
+ string[string_length] = 0;
+
if (type == DS_TYPE_COUNTER)
+ {
ret.counter = (counter_t) strtoll (string, &endptr, /* base = */ 0);
+ DEBUG ("snmp plugin: csnmp_value_list_to_value: String to counter: %s -> %llu",
+ string, (unsigned long long) ret.counter);
+ }
else if (type == DS_TYPE_GAUGE)
+ {
ret.gauge = (gauge_t) strtod (string, &endptr);
+ DEBUG ("snmp plugin: csnmp_value_list_to_value: String to gauge: %s -> %g",
+ string, (double) ret.gauge);
+ }
}
/* Check if an error occurred */
- if ((string == NULL) || (endptr == string))
+ if ((vl->val.string == NULL) || (endptr == (char *) vl->val.string))
{
if (type == DS_TYPE_COUNTER)
ret.counter = 0;