Check_metermaid callouts

From Messaging Server Technical Reference Wiki
Jump to: navigation, search



The check_metermaid.so mapping callout can be used to access MeterMaid from mapping tables or rewrite rules. A number of entry points are provided.


adjust,table,key,adjustment

(New in MS 7.0u2) Similar to store, but adjustment is treated as a delta value. It can be specified as integer, +integer, or -integer. If the key doesn't currently exist, it is presumed to be 0 and the value is set to whatever the adjustment is. Succeeds by default, fails if an error occurs.


adjust_and_test,table,key,adjustment,test-expr

(New in MS 7.0u2) This combines the adjustment with a test. The return value is the same as test.


fetch,table,key

(New in MS 7.0u2) Returns a string from that key's value. Fails if an error occurs or the key is not currently set.


greylisting,table,key



query,table,key



remove,table,key

(New in MS 7.0u2) Removes the key/value pair specified by the key from the table. Return success by default, and fail if an error occurs.


store,table,key,value

(New in MS 7.0u2) Sets the value for the specified key in that table. Returns success if completed successfully, and fails if not.


test,table,key,test-expr

(New in MS 7.0u2) test-expr is a simple expression that gives the test to be done. It consists of an operator and a value. The operator can be one of =, >, >=, <, or <=. The value should be an integer.

This returns success if the test-expr returns true, and fails if it's false or an error occurs. (This flexibility permits control of whether the default should be to pass, or to fail.)


throttle,table,key

Apply throttling.

New in MS 8.0, check_metermaid.so supports use of multiple MeterMaid servers, and also supports SSL for communication.

An example of using Metermaid to implement a simple rate limit on a given authenticated sender to 10 messages every 5 minutes implemented using a FROM_ACCESS mapping would be:


msconfig> show metermaid.local_table:sendlim
role.metermaid.local_table:sendlim.data_type = string
role.metermaid.local_table:sendlim.max_entries = 100000
role.metermaid.local_table:sendlim.quota = 10
role.metermaid.local_table:sendlim.quota_time = 300
role.metermaid.local_table:sendlim.table_type = throttle

And finally, the following callout rule added at the end of the FROM_ACCESS mapping implements the limit:


FROM_ACCESS

  TCP|*|SMTP*|MAIL|tcp_*|*|*  $C$;R$[IMTA_LIB:check_metermaid.so,throttle,sendlim,$4]$X4.2.3|$NRate$ too$ high$E

Note the "$;R" (new in MS 8.0) prevents this rule from being applied to enqueues from "internal" channels (process channel, reprocess channel, conversions channel, etc.). Also note that the rule can be added to an existing


See also: