Depth map with distance along the camera Z axis
You can achieve this using cycles' camera data node.
One of the outputs on this node is the view vector, which can be separated to x, y and z.

Using a simple node setup you can display only the Z distance from the camera in grayscale values.

In the example below I used the light falloff node to enhance the contrast (the Suzanne model is rather small and all the distances were small as a result, something that produced a low contrast whitish image, before contrast was added).

EDITED: replaced the seprate RGB with separate XYZ (does the same thing, but this demonstrates what's happening more clearly) and added an invert node so that farther values are darker (which is more intiuitive).