summaryrefslogtreecommitdiff
path: root/src/rrdcollectd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rrdcollectd.c')
-rw-r--r--src/rrdcollectd.c96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/rrdcollectd.c b/src/rrdcollectd.c
new file mode 100644
index 0000000..849f082
--- /dev/null
+++ b/src/rrdcollectd.c
@@ -0,0 +1,96 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "usuals.h"
+#include <errno.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <syslog.h>
+
+/* TODO: Abstract these headers away nicely */
+#include <bsnmp/asn1.h>
+#include <bsnmp/snmp.h>
+#include <bsnmp/snmpclient.h>
+
+/* -----------------------------------------------------------------------------
+ * TESTS
+ */
+
+static void
+test_bsnmpd()
+{
+ struct snmp_pdu pdu, resp;
+ int n;
+
+ snmp_client_init(&snmp_client);
+ snmp_client.trans = SNMP_TRANS_LOC_STREAM;
+ snmp_client_open("northstar-link.ws.local", NULL, "wsnettle", "public");
+
+ snmp_pdu_create(&pdu, SNMP_PDU_SET);
+
+ n = snmp_add_binding(&pdu, &oid_begemotAtmIfMode, SNMP_SYNTAX_INTEGER, 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");
+}
+
+/* -----------------------------------------------------------------------------
+ * STARTUP
+ */
+
+static void
+usage()
+{
+ fprintf(stderr, "usage: rrdcollectd\n");
+ fprintf(stderr, " rrdcollectd -v\n");
+ exit(2);
+}
+
+int
+main(int argc, char* argv[])
+{
+ int daemonize;
+ char ch;
+
+ /* Parse the arguments nicely */
+ while((ch = getopt(argc, argv, "v")) != -1)
+ {
+ switch(ch)
+ {
+
+ /* Print version number */
+ case 'v':
+ printf("rrdcollectd (version %s)\n", VERSION);
+ exit(0);
+ break;
+
+ /* Usage information */
+ case '?':
+ default:
+ usage();
+ break;
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ printf("TODO: Implementation here...\n");
+ return 0;
+}
+