# Shell

Contents

* [Shell](/language-guide/shell.md)
  * [Sending a metric via TCP](#sending-a-metric-via-tcp)
  * [Sending a metric via UDP](#sending-a-metric-via-udp)
  * [Sending a metric via TCP over TLS](#sending-a-metric-via-tcp-over-tls)
  * [Sending a metric via HTTPs](#sending-a-metric-via-https)
  * [Sending a metric via StatsD](#sending-a-metric-via-statsd)
  * [Sending multiple metrics with Curl](#sending-multiple-metrics-with-curl)

### [Sending a metric via TCP](#sending-a-metric-via-tcp)

Using the [netcat](http://netcat.sourceforge.net/) utility

```
echo "YOUR-API-KEY.foo 1.2" | nc carbon.hostedgraphite.com 2003
```

### [Sending a metric via UDP](#sending-a-metric-via-udp)

Using the [netcat](http://netcat.sourceforge.net/) utility

```
echo "YOUR-API-KEY.foo 1.2" | nc -uw0 carbon.hostedgraphite.com 2003
```

### [Sending a metric via TCP over TLS](#sending-a-metric-via-tcp-over-tls)

Using the [Ncat](https://nmap.org/ncat/) utility

```
echo "YOUR-API-KEY.con_users 1.3" | ncat --ssl carbon.hostedgraphite.com 20030
```

Alternatively, the following example using [OpenSSL](https://www.openssl.org/) should work out of the box in OS X:

```
echo "YOUR-API-KEY.con_users 1.3" |  openssl s_client -connect carbon.hostedgraphite.com:20030
```

### [Sending a metric via HTTPs](#sending-a-metric-via-https)

Using the [Curl](https://curl.haxx.se/) utility

```
curl https://YOUR-API-KEY@www.hostedgraphite.com/api/v1/sink --data-binary "foo 1.2"
```

### [Sending a metric via StatsD](#sending-a-metric-via-statsd)

Using the [Ncat](https://nmap.org/ncat/) utility:

```
echo "YOUR-API-KEY.foo.statsd:1.2|c" | nc -u -w1 statsd.hostedgraphite.com 8125
```

For StatsD, make sure to specify counters (c), gauges (g), or timers (ms).

### [Sending multiple metrics with Curl](#send-multiple-metrics-with-curl)

```
curl https://YOUR-API-KEY@www.hostedgraphite.com/api/v1/sink --data-binary @data.txt
```

where data.txt contains multiple metrics and values on a separate line:

Your API key can be found on your [account home](https://www.hostedgraphite.com/accounts/profile/) page.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hostedgraphite.com/language-guide/shell.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
