Skip to content

Commit

Permalink
Espresso 버전 수정 사항 적용#3
Browse files Browse the repository at this point in the history
- CB-Dragonfly
  * Config.yaml과 Telegraf 설정파일 Influx DB 계정 정보 연동 기능 추가
  • Loading branch information
pjini committed Oct 21, 2020
1 parent 6d1aee4 commit fc00c5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions file/conf/telegraf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
mcisId = "{{mcis_id}}"
vmId = "{{vm_id}}"
osType = "linux"
cspType = "{{csp_type}}"
cspType = "{{csp_type}}"\

# Configuration for telegraf agent
[agent]
Expand Down Expand Up @@ -137,7 +137,8 @@
## HTTP Basic Auth
# username = "telegraf"
# password = "metricsmetricsmetricsmetrics"

username = "{{userName}}"
password = "{{password}}"
## HTTP User-Agent
# user_agent = "telegraf"

Expand Down
5 changes: 4 additions & 1 deletion pkg/core/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ func cleanTelegrafInstall(sshInfo sshrun.SSHInfo, osType string) {
func createTelegrafConfigFile(nsId string, mcisId string, vmId string, cspType string) (string, error) {
collectorServer := fmt.Sprintf("udp://%s:%d", config.GetInstance().CollectManager.CollectorIP, config.GetInstance().CollectManager.CollectorPort)
influxDBServer := fmt.Sprintf("http://%s:8086", config.GetInstance().CollectManager.CollectorIP)

userName := fmt.Sprintf(config.GetInstance().InfluxDB.UserName)
password := fmt.Sprintf(config.GetInstance().InfluxDB.Password)
rootPath := os.Getenv("CBMON_ROOT")
filePath := rootPath + "/file/conf/telegraf.conf"

Expand All @@ -191,6 +192,8 @@ func createTelegrafConfigFile(nsId string, mcisId string, vmId string, cspType s
strConf = strings.ReplaceAll(strConf, "{{vm_id}}", vmId)
strConf = strings.ReplaceAll(strConf, "{{collector_server}}", collectorServer)
strConf = strings.ReplaceAll(strConf, "{{influxdb_server}}", influxDBServer)
strConf = strings.ReplaceAll(strConf, "{{userName}}", userName)
strConf = strings.ReplaceAll(strConf, "{{password}}", password)
strConf = strings.ReplaceAll(strConf, "{{csp_type}}", cspType)

// telegraf.conf 파일 생성
Expand Down

0 comments on commit fc00c5b

Please sign in to comment.