DEFVAL { 0 }
::= { tariffs 1 }
+totalAdmins OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total admins registered in the billing"
+ DEFVAL { 0 }
+ ::= { admins 1 }
+
+totalServices OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total services registered in the billing"
+ DEFVAL { 0 }
+ ::= { services 1 }
+
+totalCorporations OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total corporations registered in the billing"
+ DEFVAL { 0 }
+ ::= { corporations 1 }
+
END
const TARIFFS & tariffs;
};
+class TotalAdminsSensor : public Sensor {
+ public:
+ TotalAdminsSensor(const ADMINS & a) : admins(a) {}
+ virtual ~TotalAdminsSensor() {}
+
+ bool GetValue(ObjectSyntax_t * objectSyntax) const
+ {
+ ValueToOS(admins.GetAdminsNum(), objectSyntax);
+ return true;
+ }
+
+#ifdef DEBUG
+ std::string ToString() const
+ { std::string res; x2str(admins.GetAdminsNum(), res); return res; }
+#endif
+
+ private:
+ const ADMINS & admins;
+};
+
+class TotalServicesSensor : public Sensor {
+ public:
+ TotalServicesSensor(const SERVICES & s) : services(s) {}
+ virtual ~TotalServicesSensor() {}
+
+ bool GetValue(ObjectSyntax_t * objectSyntax) const
+ {
+ ValueToOS(services.GetServicesNum(), objectSyntax);
+ return true;
+ }
+
+#ifdef DEBUG
+ std::string ToString() const
+ { std::string res; x2str(services.GetServicesNum(), res); return res; }
+#endif
+
+ private:
+ const SERVICES & services;
+};
+
+class TotalCorporationsSensor : public Sensor {
+ public:
+ TotalCorporationsSensor(const CORPORATIONS & c) : corporations(c) {}
+ virtual ~TotalCorporationsSensor() {}
+
+ bool GetValue(ObjectSyntax_t * objectSyntax) const
+ {
+ ValueToOS(corporations.GetCorporationsNum(), objectSyntax);
+ return true;
+ }
+
+#ifdef DEBUG
+ std::string ToString() const
+ { std::string res; x2str(services.GetCorporationsNum(), res); return res; }
+#endif
+
+ private:
+ const CORPORATIONS & corporations;
+};
+
template <typename T>
class ConstSensor : public Sensor {
public:
#include "stg/common.h"
#include "stg/plugin_creator.h"
+#include "stg/users.h"
+#include "stg/tariffs.h"
+#include "stg/admins.h"
+#include "stg/services.h"
+#include "stg/corporations.h"
#include "smux.h"
#include "utils.h"
: PLUGIN(),
users(NULL),
tariffs(NULL),
+ admins(NULL),
+ services(NULL),
+ corporations(NULL),
running(false),
stopped(true),
sock(-1)
sensors[OID(".1.3.6.1.4.1.38313.1.1.12")] = new TariffChangeUsersSensor(*users);
// Tariffs
sensors[OID(".1.3.6.1.4.1.38313.1.2.1")] = new TotalTariffsSensor(*tariffs);
+// Admins
+sensors[OID(".1.3.6.1.4.1.38313.1.3.1")] = new TotalAdminsSensor(*admins);
+// Services
+sensors[OID(".1.3.6.1.4.1.38313.1.4.1")] = new TotalServicesSensor(*services);
+// Corporations
+sensors[OID(".1.3.6.1.4.1.38313.1.5.1")] = new TotalCorporationsSensor(*corporations);
// Table data
tables[".1.3.6.1.4.1.38313.1.1.6"] = new TariffUsersTable(".1.3.6.1.4.1.38313.1.1.6", *users);
#include "stg/os_int.h"
#include "stg/plugin.h"
#include "stg/module_settings.h"
-#include "stg/users.h"
-#include "stg/tariffs.h"
#include "sensors.h"
#include "tables.h"
class USER;
class SETTINGS;
class SMUX;
+class USERS;
+class TARIFFS;
+class SERVICES;
+class CORPORATIONS;
typedef bool (SMUX::*SMUXPacketHandler)(const SMUX_PDUs_t * pdus);
typedef bool (SMUX::*PDUsHandler)(const PDUs_t * pdus);
void SetUsers(USERS * u) { users = u; }
void SetTariffs(TARIFFS * t) { tariffs = t; }
- void SetAdmins(ADMINS *) {}
+ void SetAdmins(ADMINS * a) { admins = a; }
+ void SetServices(SERVICES * s) { services = s; }
+ void SetCorporations(CORPORATIONS * c) { corporations = c; }
void SetTraffcounter(TRAFFCOUNTER *) {}
void SetStore(STORE *) {}
void SetStgSettings(const SETTINGS *) {}
USERS * users;
TARIFFS * tariffs;
+ ADMINS * admins;
+ SERVICES * services;
+ CORPORATIONS * corporations;
mutable std::string errorStr;
SMUX_SETTINGS smuxSettings;