These small diametrically magnetized cylinders are great for use with Hall Effect Sensors. The poles are located on the sides of the cylinders, so they will attract each other as shown in the bottom picture.
This size is also available
axially magnetized in grade N52 as part number
D24-N52 and
axially magnetized in grade N42 as part number
D24.