Like ptsg states. Check oil level, oil color, smell etc.
Foaming can be from being over full which can be caused by bad seal on hydraulic pump on some models, leaking diesel lift pump on some models, antifreeze - coolant leak into oil.
Pulling dipstick is first step in trying to identify possible cause.