DEFVAL { 0 }
::= { users 11 }
+tariffChangeUsers OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of users changing tariff next month"
+ DEFVAL { 0 }
+ ::= { users 12 }
+
totalTariffs OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-only
Int2OS(objectSyntax, count);
return true;
}
+
+bool TariffChangeUsersSensor::GetValue(ObjectSyntax_t * objectSyntax)
+{
+int handle = users.OpenSearch();
+if (!handle)
+ return false;
+
+USER_PTR user;
+size_t count = 0;
+while (!users.SearchNext(handle, &user))
+ {
+ if (!user->GetProperty().nextTariff.ConstData().empty())
+ ++count;
+ }
+
+users.CloseSearch(handle);
+
+Int2OS(objectSyntax, count);
+return true;
+}
USERS & users;
};
+class TariffChangeUsersSensor : public Sensor {
+ public:
+ TariffChangeUsersSensor(USERS & u)
+ : users(u)
+ {}
+ virtual ~TariffChangeUsersSensor() {}
+
+ bool GetValue(ObjectSyntax_t * objectSyntax);
+
+ private:
+ USERS & users;
+};
+
class TotalTariffsSensor : public Sensor {
public:
TotalTariffsSensor(const TARIFFS & t)
sensors[".1.3.6.1.4.1.38313.1.1.9"] = new PassiveUsersSensor(*users);
sensors[".1.3.6.1.4.1.38313.1.1.10"] = new CreditUsersSensor(*users);
sensors[".1.3.6.1.4.1.38313.1.1.11"] = new FreeMbUsersSensor(*users);
+sensors[".1.3.6.1.4.1.38313.1.1.12"] = new TariffChangeUsersSensor(*users);
// Tariffs
sensors[".1.3.6.1.4.1.38313.1.2.1"] = new TotalTariffsSensor(*tariffs);