SB 9.14.6

śukro bṛhaspater dveṣād
 agrahīt sāsuroḍupam
haro guru-sutaṁ snehāt
 sarva-bhūta-gaṇāvṛtaḥ
Synonyms: 
śukraḥ — the demigod named Śukra; bṛhaspateḥ — unto Bṛhaspati; dveṣāt — because of enmity; agrahīt — took; sa-asura — with the demons; uḍupam — the side of the moon-god; haraḥ — Lord Śiva; guru-sutam — the side of his spiritual master’s son; snehāt — because of affection; sarva-bhūta-gaṇa-āvṛtaḥ — accompanied by all kinds of ghosts and hobgoblins.
Translation: 
Because of enmity between Bṛhaspati and Śukra, Śukra took the side of the moon-god and was joined by the demons. But Lord Śiva, because of affection for the son of his spiritual master, joined the side of Bṛhaspati and was accompanied by all the ghosts and hobgoblins.
Purport: 

The moon-god is one of the demigods, but to fight against the other demigods he took the assistance of the demons. Śukra, being an enemy of Bṛhaspati, also joined the moon-god to retaliate in wrath against Bṛhaspati. To counteract this situation, Lord Śiva, who was affectionate toward Bṛhaspati, joined Bṛhaspati. The father of Bṛhaspati was Aṅgirā, from whom Lord Śiva had received knowledge. Therefore Lord Śiva had some affection for Bṛhaspati and joined his side in this fight. Śrīdhara Svāmī remarks, aṅgirasaḥ sakāśāt prāpta-vidyo hara iti prasiddhaḥ: “Lord Śiva is well known to have received knowledge from Aṅgirā.”