+struct num_accounts {
+ long total;
+ long active;
+};
+
+/*
+ * Helper function for mrtg_accounts()
+ */
+void tally_account(struct ctdluser *EachUser, void *userdata)
+{
+ struct num_accounts *n = (struct num_accounts *) userdata;
+
+ ++n->total;
+ if ( (time(NULL) - EachUser->lastcall) <= 2592000 ) ++n->active;
+}
+
+
+/*
+ * Number of accounts and active accounts
+ */
+void mrtg_accounts(void) {
+ struct num_accounts n = {
+ 0,
+ 0
+ };
+
+ ForEachUser(tally_account, (void *)&n );
+ mrtg_output(n.total, n.active);
+}
+
+