diff --git a/src/admin.c b/src/admin.c index c01b6d36..0fdeb72b 100644 --- a/src/admin.c +++ b/src/admin.c @@ -588,6 +588,7 @@ xmlDocPtr admin_build_sourcelist(const char *mount, client_t *client, admin_form admin_build_sourcelist__add_flag(maintenancenode, flags, SOURCE_FLAG_GOT_DATA, true, "no-got-data"); admin_build_sourcelist__add_flag(maintenancenode, flags, SOURCE_FLAG_FORMAT_GENERIC, false, "format-generic"); admin_build_sourcelist__add_flag(maintenancenode, flags, SOURCE_FLAG_LEGACY_METADATA, false, "legacy-metadata"); + admin_build_sourcelist__add_flag(maintenancenode, flags, SOURCE_FLAG_AGED, true, "no-aged"); } snprintf(buf, sizeof(buf), "%"PRIu64, source->dumpfile_written); diff --git a/src/source.c b/src/source.c index b2d731ae..c1ca5fd2 100644 --- a/src/source.c +++ b/src/source.c @@ -502,12 +502,18 @@ static refbuf_t *get_next_buffer (source_t *source) } if (current >= (source->last_stats_update + 5)) { + time_t age = current - source->create_time; stats_event_args(source->mount, "total_bytes_read", "%"PRIu64, source->format->read_bytes); stats_event_args(source->mount, "total_bytes_sent", "%"PRIu64, source->format->sent_bytes); if (source->dumpfile) { stats_event_args(source->mount, "dumpfile_written", "%"PRIu64, source->dumpfile_written); } + + if (age > 30) { /* TODO: Should this be configurable? */ + source_set_flags(source, SOURCE_FLAG_AGED); + } + source->last_stats_update = current; } if (fds < 0) { @@ -1546,6 +1552,9 @@ health_t source_get_health_by_flags(source_flags_t flags) if (flags & SOURCE_FLAG_LEGACY_METADATA) health = health_atbest(health, HEALTH_ERROR); + if (!(flags & SOURCE_FLAG_AGED)) + health = health_atbest(health, HEALTH_WARNING); + return health; } diff --git a/src/source.h b/src/source.h index d7daedfd..b10b04fc 100644 --- a/src/source.h +++ b/src/source.h @@ -33,9 +33,10 @@ typedef uint_least32_t source_flags_t; #define SOURCE_FLAG_GOT_DATA ((source_flags_t)0x00000001U) #define SOURCE_FLAG_FORMAT_GENERIC ((source_flags_t)0x00000002U) #define SOURCE_FLAG_LEGACY_METADATA ((source_flags_t)0x00000004U) +#define SOURCE_FLAG_AGED ((source_flags_t)0x00000008U) #define SOURCE_FLAGS_CLEARABLE (SOURCE_FLAG_LEGACY_METADATA) -#define SOURCE_FLAGS_GOOD (SOURCE_FLAG_GOT_DATA) +#define SOURCE_FLAGS_GOOD (SOURCE_FLAG_GOT_DATA|SOURCE_FLAG_AGED) struct source_tag { mutex_t lock;