summaryrefslogtreecommitdiff
path: root/src/rrdbotd.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-01-26 09:54:31 +0000
committerStef Walter <stef@memberwebs.com>2006-01-26 09:54:31 +0000
commit1ded2732d4c290dbff64d8091def1f70b76f6282 (patch)
tree4aa4dfa403304e9ee59cce693263ca607b36502f /src/rrdbotd.c
parent7fcead4473bc224bc8c6a66e2db3b3ee87f751d4 (diff)
SNMP support coded in.
Diffstat (limited to 'src/rrdbotd.c')
-rw-r--r--src/rrdbotd.c46
1 files changed, 15 insertions, 31 deletions
diff --git a/src/rrdbotd.c b/src/rrdbotd.c
index bee836e..a28f0b0 100644
--- a/src/rrdbotd.c
+++ b/src/rrdbotd.c
@@ -64,36 +64,6 @@ static int daemonized = 0;
static int debug_level = 7;
/* -----------------------------------------------------------------------------
- * TESTS
- */
-
-#define OIDX_ifInOctets { 11, { 1, 3, 6, 1, 2, 1, 2, 2, 1, 10, 2, } }
-struct asn_oid ifInOctens = OIDX_ifInOctets;
-
-static void
-test_bsnmpd()
-{
- struct snmp_pdu pdu, resp;
- int n;
-
- snmp_client_init(&snmp_client);
- snmp_client.trans = SNMP_TRANS_UDP;
- snmp_open("northstar-link.ws.local", NULL, "wsnettle", "public");
-
- snmp_pdu_create(&pdu, SNMP_PDU_GET);
-
- n = snmp_add_binding(&pdu, &ifInOctens, SNMP_SYNTAX_COUNTER, NULL);
- if (snmp_dialog(&pdu, &resp))
- errx(1, "No response from '%s': %s", snmp_client.chost, snmp_client.error);
-
- if (snmp_pdu_check(&pdu, &resp) <= 0)
- errx(1, "Error reading from server: %s", snmp_client.error);
-
- snmp_pdu_dump(&resp);
- printf("done\n");
-}
-
-/* -----------------------------------------------------------------------------
* CLEANUP
*/
@@ -208,6 +178,8 @@ usage()
exit(2);
}
+#include <values.h>
+
int
main(int argc, char* argv[])
{
@@ -220,6 +192,8 @@ main(int argc, char* argv[])
/* TODO: These should come from configure, and from arguments */
g_state.rrddir = "/data/projects/rrdui/work";
g_state.confdir = "/data/projects/rrdui/conf";
+ g_state.retries = 3;
+ g_state.timeout = 5000;
/* Parse the arguments nicely */
while((ch = getopt(argc, argv, "v")) != -1)
@@ -244,11 +218,21 @@ main(int argc, char* argv[])
argc -= optind;
argv += optind;
+ /* The mainloop server */
+ server_init();
+
+ /* Parse config and setup SNMP system */
rb_config_parse();
+ rb_snmp_engine_init();
- printf("a test\n");
+ /* Now let it go */
+ if(server_run() == -1)
+ err(1, "critical failure running SNMP engine");
+ /* Cleanups */
+ rb_snmp_engine_uninit();
rb_config_free();
+ server_uninit();
return 0;
}