Monitoring unit for a medicament delivery device, which monitoring unit comprises - a housing, - monitoring circuit arranged in said housing, capable of detecting and monitoring functions of the medicament delivery device, - wherein an attachment end of the monitoring unit comprises an attachment mechanism comprising releasable holding elements, which releasable holding elements are designed to interact with a medicament delivery device for releasably holding said monitoring unit when attached to a medicament delivery device, wherein said holding elements are flexible in a generally radial direction and arranged to interact with mating holding elements on the medicament delivery device; wherein said flexible holding elements are in the form of attachment tongues arranged with ledges, which ledges are arranged to engage ledges of the mating holding elements; and in locking elements (500, 508, 514) operably arranged in said monitoring unit and designed to act on the holding elements, wherein the monitoring unit further comprises a mechanical interface (231, 318) arranged to interact with a mating mechanical interface arranged on a medicament delivery device, and an activation switch (242, 320) arranged to activate said monitoring circuit, - and in at least one drive element in the form of a linear actuator, a stepper motor, miniature hydraulic or pneumatic actuators, electroactive polymers, piezoelectric actuators or thermal bimorph actuators, operably connected to said locking elements (500, 508, 514) wherein, upon activation of said monitoring unit, said at least one drive element moves said locking elements (500, 508, 514) to a blocking position radially outside the holding elements preventing any flexible movement thereby preventing detachment of said monitoring unit from said medicament delivery device. - a housing, - monitoring circuit arranged in said housing, capable of detecting and monitoring functions of the medicament delivery device, - wherein an attachment end of the monitoring unit comprises an attachment mechanism comprising releasable holding elements, which releasable holding elements are designed to interact with a medicament delivery device for releasably holding said monitoring unit when attached to a medicament delivery device, wherein said holding elements are flexible in a generally radial direction and arranged to interact with mating holding elements on the medicament delivery device; wherein said flexible holding elements are in the form of attachment tongues arranged with ledges, which ledges are arranged to engage ledges of the mating holding elements; and in locking elements (500, 508, 514) operably arranged in said monitoring unit and designed to act on the holding elements, wherein the monitoring unit further comprises a mechanical interface (231, 318) arranged to interact with a mating mechanical interface arranged on a medicament delivery device, and an activation switch (242, 320) arranged to activate said monitoring circuit, said holding elements are flexible in a generally radial direction and arranged to interact with mating holding elements on the medicament delivery device; wherein said flexible holding elements are in the form of attachment tongues arranged with ledges, which ledges are arranged to engage ledges of the mating holding elements; and in locking elements (500, 508, 514) operably arranged in said monitoring unit and designed to act on the holding elements, wherein the monitoring unit further comprises a mechanical interface (231, 318) arranged to interact with a mating mechanical interface arranged on a medicament delivery device, and an activation switch (242, 320) arranged to activate said monitoring circuit, - and in at least one drive element in the form of a linear actuator, a stepper motor, miniature hydraulic or pneumatic actuators, electroactive polymers, piezoelectric actuators or thermal bimorph actuators, operably connected to said locking elements (500, 508, 514) wherein, upon activation of said monitoring unit, said at least one drive element moves said locking elements (500, 508, 514) to a blocking position radially outside the holding elements preventing any flexible movement thereby preventing detachment of said monitoring unit from said medicament delivery device.