there might be far better solutions, but I'd write a small script that would be called before the check.
do a ping to the computer
if ping OK
=> do the test (that is passed as arguments)
if ping KO
as I said, there might be some tweaks you could do with nagios itself, but as far as I know, it's often tricky and hard to remember what and why you did