What is the grammatical function of 當 and 自 in 爾男子，當自警 ? Two lines from 三字經 are 爾男子，當自警.

I understand 爾男子 as "you boys" as if asking for attention by adressing them.
警 is to warn or to guard or being in a state of attentive observation.
Now as for 當 and 自 I am very unsure, 
what is their function in this sentence , how  would you explain their grammatical roles in terms of English grammar (adverbs, particles,sth. else ? )
If,

當 = should / must

自警 = self-discipline

What do you think their grammatical roles are?