I second what Judanssi says, so switch to nagios user and run the command, just like you defined. For your example, it would be
su nagios -c "/usr/bin/eject cdrom"
Only after you have successfully tested the command, define it in nagios, just to avoid small issues like typos, permissions or other assumptions.
In this specific case (taking it as certain) there can be details like "eject" is not in /usr/bin. I've found that in suse it's in /bin; in RHEL, it's in /usr/sbin, and in ubuntu, it's in /usr/bin.