[Latin -mentum or French -ment.]
The Latin and French endings were originally added to verbs. Two words based on Latin verbs are ornament (Latin ornare, adorn) and testament (Latin testamentum, a will, from testari, to testify). Two based on French verbs are appeasement (Old French apaisier, from pais, peace), and encouragement (French encourager, based on corage, courage).
English has usually followed suit by adding the ending to verbs. Many nouns in -ment indicate either the result of an action or the process involved: acknowledgment, curtailment, excitement, harassment, treatment, wonderment.
Comparatively few words have been formed since the seventeenth century (two that have are recruitment and secondment), though it is occasionally used to make short-lived forms like chortlement. It is rare to find terms based on other parts of speech, though merriment has been created from merry and oddment from odd.