drop dead code

This commit is contained in:
Charlie Root 2025-02-14 17:45:01 +01:00
parent f160c0f4e3
commit e547ee2b51
3 changed files with 2 additions and 43 deletions

40
mib.c
View File

@ -81,25 +81,9 @@ struct agentx_context *sac;
struct snmpd *snmpd_env;
void mib_hrsystemuptime(struct agentx_varbind *);
void mib_hottisntpdcounter(struct agentx_varbind *);
void
mib_hrsystemuptime(struct agentx_varbind *vb)
{
struct timespec uptime;
long long ticks;
if (clock_gettime(CLOCK_BOOTTIME, &uptime) == -1) {
log_warn("clock_gettime");
agentx_varbind_error(vb);
return;
}
ticks = uptime.tv_sec * 100 + uptime.tv_nsec / 10000000;
agentx_varbind_timeticks(vb, ticks);
}
void
mib_hottisntpdcounter(struct agentx_varbind *vb)
{
@ -122,9 +106,6 @@ main(int argc, char *argv[])
int verbose = 0, daemonize = 1, debug = 0;
char *context = NULL;
const char *errstr;
/* HOST-RESOURCES-MIB */
struct agentx_region *host;
struct agentx_object *hrSystemUptime;
struct agentx_region *hottis;
struct agentx_object *hottisNtpdCounter;
@ -137,17 +118,8 @@ main(int argc, char *argv[])
agentx_log_info = log_info;
agentx_log_debug = log_debug;
while ((ch = getopt(argc, argv, "C:c:ds:vx:")) != -1) {
while ((ch = getopt(argc, argv, "c:ds:vx:")) != -1) {
switch (ch) {
case 'C':
if (strcmp(optarg, "filter-routes") == 0) {
conf.sc_rtfilter = ROUTE_FILTER(RTM_NEWADDR) |
ROUTE_FILTER(RTM_DELADDR) |
ROUTE_FILTER(RTM_IFINFO) |
ROUTE_FILTER(RTM_IFANNOUNCE);
}
break;
case 'c':
context = optarg;
break;
@ -171,7 +143,7 @@ main(int argc, char *argv[])
daemonize = 0;
break;
default:
fatalx("usage: snmpd_metrics [-dv] [-C option] "
fatalx("usage: snmpd_ntpd [-dv] "
"[-c context] [-s master]\n");
}
}
@ -221,14 +193,6 @@ main(int argc, char *argv[])
if (setuid(pw->pw_uid) == -1)
fatal("setuid");
/* HOST-RESOURCES-MIB */
if ((host = agentx_region(sac, AGENTX_OID(HOST), 0)) == NULL)
fatal("agentx_region");
if ((hrSystemUptime = agentx_object(host, AGENTX_OID(HRSYSTEMUPTIME),
NULL, 0, 0, mib_hrsystemuptime)) == NULL)
fatal("agentx_object");
if ((hottis = agentx_region(sac, AGENTX_OID(HOTTIS_MIB), 0)) == NULL)
fatal("agentx_region");

4
mib.h
View File

@ -18,10 +18,6 @@
#include <agentx.h>
#define HOST AGENTX_MIB2, 253
#define HRSYSTEM HOST, 1
#define HRSYSTEMUPTIME HRSYSTEM, 1
#define HOTTIS_MIB 1,3,6,1,4,1,9676
#define HOTTIS_NTPD HOTTIS_MIB, 1
#define HOTTIS_NTPD_COUNTER HOTTIS_NTPD, 1

View File

@ -94,7 +94,6 @@
struct snmpd {
int sc_ncpu;
int64_t *sc_cpustates;
int sc_rtfilter;
};
extern struct snmpd *snmpd_env;