The High Luminosity upgrade of the LHC (HL-LHC) places unprecedented requirements for background monitoring and luminosity measurements. The CMS Tracker Endcap Pixel Detector (TEPX) will be adapted to provide high-precision online measurements of bunch-by-bunch luminosity and beam-induced background. The implementation of dedicated triggering and readout systems, the real-time clustering algorithm on an FPGA and the expected performance are discussed. The innermost ring of the last layer (D4R1) will be operated independently from the rest of TEPX enabling beam monitoring during the LHC ramp and during unqualified beam conditions. The system optimisation and the dedicated timing and trigger infrastructure for D4R1 are also presented.