Skip to content

Commit

Permalink
Merge pull request #2795 from jimis/open_monitord
Browse files Browse the repository at this point in the history
Open custom measurements in cf-monitord
  • Loading branch information
jimis authored Feb 9, 2018
2 parents ceb1a50 + 312b8ec commit 34c3ddb
Show file tree
Hide file tree
Showing 27 changed files with 2,753 additions and 56 deletions.
2 changes: 1 addition & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ misc/determine-version.py > CFVERSION \
echo "$0: Running autoreconf ..."
autoreconf -Wno-portability --force --install -I m4 || exit

cd - # back to original directory
cd - >/dev/null # back to original directory

if [ -z "$NO_CONFIGURE" ]
then
Expand Down
21 changes: 20 additions & 1 deletion cf-monitord/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ libcf_monitord_la_LIBADD = ../libpromises/libpromises.la

libcf_monitord_la_SOURCES = \
verify_measurements.c verify_measurements.h \
cf-monitord-enterprise-stubs.c cf-monitord-enterprise-stubs.h \
env_monitor.c env_monitor.h \
mon.h \
mon_cpu.c \
Expand All @@ -51,8 +50,28 @@ libcf_monitord_la_SOURCES = \
mon_network.c \
mon_processes.c \
mon_temp.c \
history.c history.h \
mon_cumulative.c mon_cumulative.h \
probes.c probes.h \
monitoring.c monitoring.h \
cf-monitord.c

if LINUX
libcf_monitord_la_SOURCES += mon_io_linux.c mon_mem_linux.c
endif

if SOLARIS
libcf_monitord_la_SOURCES += mon_mem_solaris.c shared_kstat.c shared_kstat.h
endif

if !LINUX
libcf_monitord_la_SOURCES += mon_io_stub.c
if !SOLARIS
libcf_monitord_la_SOURCES += mon_mem_stub.c
endif
endif


if !BUILTIN_EXTENSIONS
bin_PROGRAMS = cf-monitord
# Workaround for automake madness (try removing it if you want to know why).
Expand Down
16 changes: 10 additions & 6 deletions cf-monitord/env_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
included file COSL.txt.
*/


#include <env_monitor.h>

#include <eval_context.h>
Expand All @@ -44,8 +45,11 @@
#include <unix.h>
#include <verify_measurements.h>
#include <verify_classes.h>
#include <cf-monitord-enterprise-stubs.h>
#include <known_dirs.h>
#include <probes.h> /* MonOtherInit,MonOtherGatherData */
#include <history.h> /* HistoryUpdate */
#include <monitoring.h> /* GetObservable */


/*****************************************************************************/
/* Globals */
Expand Down Expand Up @@ -404,14 +408,14 @@ static Averages EvalAvQ(EvalContext *ctx, char *t)
}

// lastweek_vals is last week's stored data

This =
RejectAnomaly(CF_THIS[i], lastweek_vals->Q[i].expect, lastweek_vals->Q[i].var, LOCALAV.Q[i].expect,
LOCALAV.Q[i].var);

newvals.Q[i].q = This;
newvals.last_seen = now; // Record the freshness of this slot

LOCALAV.Q[i].q = This;

Log(LOG_LEVEL_DEBUG, "Previous week's '%s.q' %lf", name, lastweek_vals->Q[i].q);
Expand All @@ -432,7 +436,7 @@ static Averages EvalAvQ(EvalContext *ctx, char *t)
else
{
newvals.Q[i].dq = 0;
LOCALAV.Q[i].dq = 0;
LOCALAV.Q[i].dq = 0;
}

// Save the last measured value as the value "from five minutes ago" to get the gradient
Expand Down Expand Up @@ -709,13 +713,13 @@ static void ArmClasses(EvalContext *ctx, Averages av)
snprintf(buff,CF_BUFSIZE,"udp6_port_addr[%s]=%s",ip->name,ip->classes);
AppendItem(&mon_data, buff, NULL);
}

for (ip = MON_UDP4; ip != NULL; ip=ip->next)
{
snprintf(buff,CF_BUFSIZE,"udp4_port_addr[%s]=%s",ip->name,ip->classes);
AppendItem(&mon_data, buff, NULL);
}

PublishEnvironment(mon_data);

DeleteItemList(mon_data);
Expand Down
Loading

0 comments on commit 34c3ddb

Please sign in to comment.