Mailman List Configurations
In this example, we monitor and report problems with GNU Mailman list configurations. We might have default policies on subscription or moderation, for example. If one or more lists were misconfigured to violate those policies, we would want report of that.
The MailmanListConfigs script might send an alert message like the following:
PIKT ALERT Fri Sep 23 01:19:02 2005 moscow WARNING: MailmanListConfigs Check and report problems with Mailman list configurations. emf-exec: send_reminders = True emf-exec: subscribe_policy = 2 emf-exec: default_member_moderation = False emf-lead: moderator = [''] emf-lead: send_reminders = True emf-lead: default_member_moderation = False emf-lead: archive_private = 0 pikt-users: generic_nonmember_action = 3 pikt-workers: generic_nonmember_action = 3
The script follows.
MailmanListConfigs init status active level warning task "Monitor and report problems with Mailman list configurations." input proc "for list in `=mailmanbindir/list_lists | =tail +2 | =awk '{print $1}'`; do echo LIST:$list; =mailmanbindir/config_list -o - $list 2>/dev/null; done" rule // bypass comments if $inlin =~ "^#" next fi rule // get the list name if $inlin =~ "^LIST:(.+)$" set $list = $lower($1) next fi #ifndef debug rule // bypass auxiliary and test lists if $list =~ "mailman|test" next fi #endifdef rule // send_reminders if $inlin =~~ "^send_reminders = (.+)" set $option = $lower($1) if $option =~~ "1|true|yes" output mail "$list: $inlin" fi fi rule // send_welcome_msg if $inlin =~~ "^send_welcome_msg = (.+)" set $option = $lower($1) if $option =~~ "0|false|no" output mail "$list: $inlin" fi fi rule // send_goodbye_msg if $inlin =~~ "^send_goodbye_msg = (.+)" set $option = $lower($1) if $option =~~ "0|false|no" output mail "$list: $inlin" fi fi rule // admin_immed_notify if $inlin =~~ "^admin_immed_notify = (.+)" set $option = $lower($1) if $option =~~ "0|false|no" output mail "$list: $inlin" fi fi rule // admin_notify_mchanges if $inlin =~~ "^admin_notify_mchanges = (.+)" set $option = $lower($1) if $option =~~ "0|false|no" output mail "$list: $inlin" fi fi rule // advertised if $inlin =~~ "^advertised = (.+)" set $option = $lower($1) if $option =~~ "1|true|yes" // these lists are public && $list !~~ "pikt-users|pikt-workers" output mail "$list: $inlin" fi fi rule // subscribe_policy if $inlin =~~ "^subscribe_policy = (.+)" set $option = $lower($1) if $option !~~ "1" // 1 = Confirm (only) output mail "$list: $inlin" fi fi rule // unsubscribe_policy if $inlin =~~ "^unsubscribe_policy = (.+)" set $option = $lower($1) if $option =~~ "1|true|yes" // 1 is require approval && $list !~ "emf-announce" output mail "$list: $inlin" fi fi rule // private_roster if $inlin =~~ "^private_roster = (.+)" set $option = $lower($1) if $option =~~ "0" // 0 = Anyone output mail "$list: $inlin" elsif $option =~~ "1" // 1 = List members && $list !~~ "emf-exec|emf-lead" output mail "$list: $inlin" fi fi rule // default_member_moderation if $inlin =~~ "^default_member_moderation = (.+)" set $option = $lower($1) if $option =~~ "0|false|no" output mail "$list: $inlin" fi fi rule // member_moderation_action if $inlin =~~ "^member_moderation_action = (.+)" set $option = $lower($1) if $option !~~ "0" // 0 = Hold output mail "$list: $inlin" fi fi rule // generic_nonmember_action if $inlin =~~ "^generic_nonmember_action = (.+)" set $option = $lower($1) if $option !~~ "1" // 0 = Hold output mail "$list: $inlin" fi fi rule // archive if $inlin =~~ "^archive = (.+)" set $option = $lower($1) // archive all lists if $option =~~ "0|false|no" output mail "$list: $inlin" fi fi rule // archive_private if $inlin =~~ "^archive_private = (.+)" set $option = $lower($1) if $option !~~ "1" // 1 = private // allow public archive for these lists && $list !~~ "pikt-users" output mail "$list: $inlin" fi fi [... other rules omitted ...]
In each rule, we consider just one configuration parameter, for example default_member_moderation. If an option does not match the desired setting, or if it matches an undesired setting, we report that. Note how we set exceptions for certain lists in the unsubscribe_policy and private_roster rules.
This is just one program example. You could write new scripts, for example to: report changes in Mailman list memberships, report failures to archive list messages, etc.
For more examples, see Samples.