Error writing to outputs.graphite: could not write to any server in cluster

When i run telegraf using
telegraf --config /usr/local/etc/telegraf.conf --config-directory /usr/local/etc/telegraf.d --debug

I see the wsg file is getting updated on the graphite.

But when i run the telegraf using brew
brew services restart telegraf

I get error like Error writing to outputs.graphite: could not write to any server in cluster

I have checked both command are using same configuration files