DEFVAL { 0 }
::= { users 11 }
+activeUsers OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of online users with traffic during session"
+ DEFVAL {0}
+ ::= { users 12 }
+
totalTariffs OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-only
return res;
}
#endif
+
+bool ActiveUsersSensor::UserPredicate(USER_PTR userPtr) const
+{
+if (!userPtr->GetConnected())
+ return false;
+for (size_t i = 0; i < DIR_NUM; ++i)
+ {
+ if (userPtr->GetSessionUpload()[i] > 0 ||
+ userPtr->GetSessionDownload()[i] > 0)
+ return true;
+ }
+return false;
+}
{ return !userPtr->GetProperty().nextTariff.ConstData().empty(); }
};
+class ActiveUsersSensor : public UsersSensor {
+ public:
+ ActiveUsersSensor(USERS & u) : UsersSensor(u) {}
+ virtual ~ActiveUsersSensor() {}
+
+ private:
+ bool UserPredicate(USER_PTR userPtr) const;
+};
+
class TotalTariffsSensor : public Sensor {
public:
TotalTariffsSensor(const TARIFFS & t) : tariffs(t) {}
sensors[OID(".1.3.6.1.4.1.38313.1.1.9")] = new CreditUsersSensor(*users);
sensors[OID(".1.3.6.1.4.1.38313.1.1.10")] = new FreeMbUsersSensor(*users);
sensors[OID(".1.3.6.1.4.1.38313.1.1.11")] = new TariffChangeUsersSensor(*users);
+sensors[OID(".1.3.6.1.4.1.38313.1.1.12")] = new ActiveUsersSensor(*users);
// Tariffs
sensors[OID(".1.3.6.1.4.1.38313.1.2.1")] = new TotalTariffsSensor(*tariffs);
// Admins