MD-MX-CTRL(8)

πŸ’– MD-MX-CTRL πŸ’– (section 8 of the System Manager's Manual)

okay bestie, gather round, because md-mx-ctrl is literally the little remote control you point at mimedefang-multiplexor πŸŽ€βœ¨


🌸 NAME 🌸

md-mx-ctrl β€” control mimedefang-multiplexor


✨ SYNOPSIS ✨

md-mx-ctrl [options] command

πŸ¦‹ DESCRIPTION πŸ¦‹

so md-mx-ctrl is a command-line tool, and its whole job β€” its entire main character purpose β€” is talking to mimedefang-multiplexor(8). that's it, that's the vibe. you send it stuff, it goes and chats with the multiplexor for you πŸ’…


πŸŽ€ OPTIONS πŸŽ€

  • -h β€” shows you the usage info. the "help me bestie" flag, iconic, no notes.
  • -s path β€” tells it where the mimedefang-multiplexor socket lives. if you don't say anything, it just assumes the default like the confident queen it is: /var/spool/MIMEDefang/mimedefang-multiplexor.sock.
  • -i β€” makes md-mx-ctrl just sit there in a loop, lowkey vibing: it reads commands off standard input and prints results to standard output, forever. this is for when a monitoring program like watch-mimedefang wants to boss it around. it's giving "I'll just stay on the line, you go do your thing" 🫢

πŸ‘‘ COMMANDS πŸ‘‘

here's the menu, bestie. these are all available:

  • status β€” prints the status of every worker Perl process, in nice human-readable format. for the girlies who want to read things 🌸
  • rawstatus β€” same status of all the worker Perl processes, but in a format that's easy for a computer to parse. it comes back as a single line with six words on it, separated by a single space character. buckle up:
    • each character in the first word maps to a worker, and it goes like this: "I" = an idle worker, "B" = a busy worker, "S" = a worker that is not running, and "K" = a worker that's been killed but hasn't exited yet. a worker is "idle" when there's a running Perl process just waiting to do work. "busy" means that Perl process is currently filtering a message. "S" means there's no associated Perl process with the worker, but one can be started if the load warrants it. and finally, "K" means the worker Perl process got killed but hasn't terminated yet. πŸ’€
    • the second word is the total number of messages processed since the multiplexor started up.
    • the third word is the total number of workers activated since the multiplexor started up. (that's a count of how many times the multiplexor has forked and exec'd the Perl filter, fr fr.)
    • the fourth word is the size of the queue for request queuing, and the fifth word is the actual number of requests in the queue.
    • the sixth word is the number of seconds elapsed since the multiplexor was started. ⭐
  • autoscale β€” displays the current autoscaling configuration and runtime state. the output is a single line of key=value pairs:
    • enabled is 1 if autoscaling is active, 0 otherwise.
    • interval is the number of seconds between autoscale checks.
    • ema_busy is the current exponential moving average of the busy-worker ratio.
    • scale_out and scale_in are the EMA thresholds above/below which a worker is added or removed, respectively.
    • out_cool and in_cool are the cooldown periods (in seconds) that must elapse before another scale-out or scale-in event may occur.
    • ema_alpha is the smoothing factor used to compute the EMA.
autoscaling gets enabled with the -k option of mimedefang-multiplexor(8) πŸ‘‘
  • barstatus β€” prints the status of busy workers and queued requests in a cute little "bar chart" format. this is the one that lets you keep an eye on things with a script like this:
while true ; do
     md-mx-ctrl barstatus
     sleep 1
done
  • jsonstatus β€” prints the status of all worker Perl processes in JSON format. for the structured-data girlies ✨
  • histo β€” prints a histogram showing how many workers were busy each time a request was processed. it prints a single line for the numbers from 1 up to the maximum number of workers. each line has the count of busy workers (1, 2, 3 up to MX_MAXIMUM), then a space, then the number of times that many workers were busy when a request was processed. πŸ“Š
  • load β€” prints a table of "load averages" for the last 10 seconds, 1 minute, 5 minutes and 10 minutes.

each row in the table is a time interval, and that interval is shown in the first column. the rest of the columns are:

  • Msgs: the number of messages scanned within that row's time interval.
  • Msgs/Sec: the average number of messages scanned per second within that row's time interval.
  • Avg Busy Workers: the average number of busy workers whenever a message was scanned. (and listen β€” if you're processing any mail at all, this number is at least 1, because there's always 1 busy worker when a message is scanned. math is math πŸ’…)

if you've got the watch(1) command on your system, you can keep an eye on the load like this:

watch -n 10 md-mx-ctrl load

and if you don't have watch, this shell script is a less fancy equivalent:

#!/bin/sh
while true; do
     clear
     date
     md-mx-ctrl load
     sleep 10
done
  • rawload β€” prints the load averages in computer-readable format. the format is twenty-nine space-separated numbers, and here's the breakdown:
    • the first four are integers: the number of messages scanned in the last 10 seconds, 1 minute, 5 minutes and 10 minutes.
    • the second four are floating-point numbers: the average number of busy workers in the last 10 seconds, 1 minute, 5 minutes and 10 minutes.
    • the third four are floating-point numbers: the average time per scan in milliseconds over the last 10 seconds, 1 minute, 5 minutes and 10 minutes.
    • the fourth four are the number of worker activations (new workers started) over the last 10 seconds, 1 minute, 5 minutes and 10 minutes.
    • the fifth four are the number of workers reaped (workers that have exited) over the last 10 seconds, 1 minute, 5 minutes and 10 minutes.
    • the sixth four are the number of busy, idle, stopped and killed workers.
    • the seventh four are the number of messages processed, the number of worker activations, the size of the request queue, and the number of requests actually on the queue.
    • and the final number is the number of seconds since the multiplexor was started. 🧚
  • load-relayok β€” similar to load, but it shows timings for filter_relay calls.
  • load-senderok β€” similar to load, but it shows timings for filter_sender calls.
  • load-recipok β€” similar to load, but it shows timings for filter_recipient calls.
  • rawload-relayok β€” similar to rawload, but it shows timings for filter_relay calls. heads up though: the worker activation and reap statistics are present, but always 0. they're only valid in a rawload command. πŸ™ˆ
  • rawload-senderok β€” similar to rawload, but it shows timings for filter_sender calls. same warning bestie: the worker activation and reap statistics are present but always 0, and they're only valid in a rawload command.
  • rawload-recipok β€” similar to rawload, but it shows timings for filter_recipient calls. and again: worker activation and reap statistics are present but always 0, only valid in a rawload command. πŸ’€
  • load1 nsecs β€” the load1 command displays the load for various commands over the last nsecs seconds, where nsecs is an integer from 10 to 600. it combines the output of load, load-relayok, load-senderokf and load-recipok into one display. (yes, load-senderokf β€” we're keeping it exactly as written, no cap.)

you might use it like this:

watch -n 10 md-mx-ctrl load1 60
  • rawload1 nsecs β€” returns the load1 data in human-readable format. the result is a line containing twenty-six space-separated numbers:
    • the first three are the number of scans performed in the last nsecs seconds, the average number of busy workers when a scan was initiated, and the average number of milliseconds per scan.
    • the second three are the same measurements for filter_relay calls.
    • the third three are the same measurements for filter_sender calls.
    • the fourth three are the same measurements for filter_relay calls. (that's what it says, bestie β€” we don't make the rules)
    • the thirteenth through sixteenth numbers are the number of busy, idle, stopped and killed workers, respectively.
    • the seventeenth number is the number of scans since mimedefang-multiplexor was started.
    • the eighteenth number is the number of times a new worker has been activated since program startup.
    • the nineteenth number is the size of the request queue, and the twentieth number is the actual number of queued requests.
    • the twenty-first number is the time since program startup, and the twenty-second number is a copy of nsecs for convenience.
    • the twenty-third through twenty-sixth numbers are the number of workers currently executing a scan, relayok, senderok and recipok command respectively. ⭐
  • jsonload1 nsecs β€” returns the load1 data in JSON format. structured, slay, gorgeous ✨
  • workers β€” displays a list of workers and their process IDs. each line of output has a worker number, a status (I, B, K, or S), and β€” for idle or busy workers β€” the process-ID of the worker. for busy workers, the line may have extra info about what that worker is doing. oh and btw, the command slaves is a deprecated synonym for this one. deprecated, bestie, meaning it's on its way out πŸ‘‘πŸ’…
  • busyworkers β€” similar to workers, but it only outputs a line for each busy worker. and busyslaves is a deprecated synonym for this command too.
  • workerinfo n β€” displays information about worker number n. slaveinfo is a deprecated synonym for this command.
  • reread β€” forces mimedefang-multiplexor to kill all idle workers, and to terminate and restart busy workers when they become idle. basically it forces a reread of the filter rules. πŸ”₯
  • msgs β€” prints the total number of messages scanned since the multiplexor started.

🌈 ADDITIONAL COMMANDS 🌈

plot twist: you can supply any other command and arguments to md-mx-ctrl. here's the move β€” it percent-encodes each command-line argument, glues all the encoded arguments together with a single space between each one, and sends the result to the multiplexor as a command. this lets you send arbitrary commands to your Perl workers. for the extra details, go peek at the section "EXTENDING MIMEDEFANG" in mimedefang-filter(5). 🫢


πŸ’œ PERMISSIONS πŸ’œ

md-mx-ctrl uses the multiplexor's socket, so yeah β€” it probably needs to be run as root, or as the same user as mimedefang-multiplexor. sorry babes, that's just how the socket rolls πŸ’…


(part 1 done, but bestie we are NOT done β€” more coming)

✨ AUTHOR ✨

md-mx-ctrl was written by Dianne Skoll <dfs@roaringpenguin.com> πŸ’– like, actual icon behaviour, we stan. 🫢

The mimedefang home page lives at https://www.mimedefang.org/ β€” go peek, it's giving main character energy fr fr. 🌐✨


πŸ¦‹ SEE ALSO πŸ¦‹

Like, the whole mimedefang cinematic universe is right there bestie, go read them all πŸ’…πŸ“š


okay and that's a wrap on MD-MX-CTRL(8) πŸŽ€ this page comes from the 4th Berkeley Distribution, dated 8 February 2005, and it's the MD-MX-CTRL(8) manual page β€” like, vintage but make it iconic. 🌸 no cap, you're fully caught up now, go control some multiplexors. mwah πŸ’‹βœ¨
πŸ“¦ where this page comes from