Use APPSERVER_PROBE_NAME for the service name

This commit is contained in:
Pierre Pronchery 2022-05-22 04:30:34 +02:00
parent 4e8f4d4c97
commit 7d3623fab3
3 changed files with 15 additions and 7 deletions

View File

@ -21,10 +21,14 @@
#include <System/App.h> #include <System/App.h>
#include "rrd.h" #include "rrd.h"
#include "damon.h" #include "damon.h"
#include "../config.h"
/* constants */ /* constants */
#ifndef APPSERVER_PROBE_NAME
# define APPSERVER_PROBE_NAME PACKAGE
#endif
#ifndef PROGNAME_DAMON #ifndef PROGNAME_DAMON
# define PROGNAME_DAMON "DaMon" # define PROGNAME_DAMON "DaMon"
#endif #endif
#define DAMON_SEP '/' #define DAMON_SEP '/'
@ -113,8 +117,8 @@ static AppClient * _refresh_connect(Host * host, Event * event)
{ {
if(setenv("APPSERVER_Probe", host->hostname, 1) != 0) if(setenv("APPSERVER_Probe", host->hostname, 1) != 0)
return NULL; return NULL;
if((host->appclient = appclient_new_event(NULL, "Probe", NULL, event)) if((host->appclient = appclient_new_event(NULL, APPSERVER_PROBE_NAME,
== NULL) NULL, event)) == NULL)
error_print(PROGNAME_DAMON); error_print(PROGNAME_DAMON);
return host->appclient; return host->appclient;
} }

View File

@ -30,8 +30,11 @@
#include "../data/Probe.h" #include "../data/Probe.h"
#include "../config.h" #include "../config.h"
#ifndef APPSERVER_PROBE_NAME
# define APPSERVER_PROBE_NAME PACKAGE
#endif
#ifndef PROGNAME_PROBE #ifndef PROGNAME_PROBE
# define PROGNAME_PROBE PACKAGE # define PROGNAME_PROBE PACKAGE
#endif #endif
@ -685,8 +688,9 @@ static int _probe(AppServerOptions options)
free(probe.volinfo); free(probe.volinfo);
return _probe_error(1); return _probe_error(1);
} }
if((appserver = appserver_new_event(&probe, options, "Probe", NULL, if((appserver = appserver_new_event(&probe, options,
event)) == NULL) APPSERVER_PROBE_NAME, NULL, event))
== NULL)
{ {
free(probe.ifinfo); free(probe.ifinfo);
free(probe.volinfo); free(probe.volinfo);

View File

@ -30,7 +30,7 @@ install=$(BINDIR)
depends=damon.h,rrd.h,../config.h depends=damon.h,rrd.h,../config.h
[damon-backend.c] [damon-backend.c]
depends=damon.h,rrd.h,damon-backend-app.c,damon-backend-salt.c depends=damon.h,rrd.h,damon-backend-app.c,damon-backend-salt.c,../config.h
[damon-main.c] [damon-main.c]
depends=damon.h depends=damon.h