Israel has agreed to a ceasefire with Lebanon-based Hezbollah militants after nearly 14 months of cross-border fire that has dealt a heavy blow to both countries.