Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gostatsd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ale
gostatsd
Commits
120c87f6
Commit
120c87f6
authored
Jun 02, 2012
by
Kamil Kisiel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added command-line options for configuring the server
parent
e3d57fc8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
gostatsd/gostatsd.go
gostatsd/gostatsd.go
+29
-2
No files found.
gostatsd/gostatsd.go
View file @
120c87f6
package
main
import
(
"log"
"flag"
"fmt"
"github.com/kisielk/gostatsd/statsd"
"log"
"os"
)
var
(
metricsAddr
string
consoleAddr
string
graphiteAddr
string
)
func
init
()
{
const
(
defaultMetricsAddr
=
":8125"
defaultConsoleAddr
=
":8126"
defaultGraphiteAddr
=
""
)
flag
.
StringVar
(
&
metricsAddr
,
"l"
,
defaultMetricsAddr
,
"Address on which to listen for metrics (optional)"
)
flag
.
StringVar
(
&
consoleAddr
,
"c"
,
defaultConsoleAddr
,
"Address on which to listen for console sessions (optional)"
)
flag
.
StringVar
(
&
graphiteAddr
,
"g"
,
defaultGraphiteAddr
,
"Address of the graphite server (required)"
)
}
func
main
()
{
err
:=
statsd
.
ListenAndServe
(
":8125"
,
":8126"
,
"localhost:1234"
)
flag
.
Parse
()
if
graphiteAddr
==
""
{
fmt
.
Printf
(
"Error: You must provide the address of the graphite server with the -g flag
\n
"
)
fmt
.
Fprintf
(
os
.
Stderr
,
"Usage of %s:
\n
"
,
os
.
Args
[
0
])
flag
.
PrintDefaults
()
return
}
err
:=
statsd
.
ListenAndServe
(
metricsAddr
,
consoleAddr
,
graphiteAddr
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment