From e92a95da6b68449925ccf6e38a327c0550e9435b Mon Sep 17 00:00:00 2001 From: niean Date: Tue, 9 Jun 2015 12:42:43 +0000 Subject: [PATCH] rollback to central lib --- collector/collector.go | 4 +-- g/g.go | 2 +- g/git.go | 2 +- index/index_delete_task.go | 2 +- index/index_update_all.py | 47 ---------------------------------- index/index_update_all_task.go | 4 +-- monitor/monitor.go | 10 ++++---- proc/proc.go | 2 +- 8 files changed, 13 insertions(+), 60 deletions(-) delete mode 100644 index/index_update_all.py diff --git a/collector/collector.go b/collector/collector.go index 013f0db..c041919 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -4,12 +4,12 @@ import ( "bytes" "encoding/json" "fmt" - cron "github.com/niean/cron" - nhttpclient "github.com/niean/gotools/http/httpclient" "github.com/open-falcon/common/model" "github.com/open-falcon/task/g" "github.com/open-falcon/task/proc" sema "github.com/toolkits/concurrent/semaphore" + cron "github.com/toolkits/cron" + nhttpclient "github.com/toolkits/http/httpclient" "io/ioutil" "log" "net/http" diff --git a/g/g.go b/g/g.go index 02553df..822b7b2 100644 --- a/g/g.go +++ b/g/g.go @@ -10,7 +10,7 @@ import ( // 0.0.3: add readme, add gitversion, modify proc, add config reload // 0.0.4: make collector configurable, add monitor cron, adjust index db // Changes: send turning-ok only after alarm happens, add conn timeout for http -// maybe fix bug of 'too many open files' +// maybe fix bug of 'too many open files', rollback to central lib const ( VERSION = "0.0.4" ) diff --git a/g/git.go b/g/git.go index 98a847f..17dca7c 100644 --- a/g/git.go +++ b/g/git.go @@ -1,4 +1,4 @@ package g const ( - COMMIT = "41e56f8" + COMMIT = "651b76b" ) diff --git a/index/index_delete_task.go b/index/index_delete_task.go index 16d4871..7355ccc 100644 --- a/index/index_delete_task.go +++ b/index/index_delete_task.go @@ -1,10 +1,10 @@ package index import ( - cron "github.com/niean/cron" Mdb "github.com/open-falcon/common/db" "github.com/open-falcon/task/proc" TSemaphore "github.com/toolkits/concurrent/semaphore" + cron "github.com/toolkits/cron" "log" "time" ) diff --git a/index/index_update_all.py b/index/index_update_all.py deleted file mode 100644 index 099ea1e..0000000 --- a/index/index_update_all.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/env python -# -*- coding: utf-8 -*- - -import time, socket, json, httplib -import sys, getopt - -urlUpdateAllFmt = "/index/updateAll?step=172800" - -def update_index(host, port, url): - result = None - httpClient = None - print "{host}:{port}{url}".format(host=host,port=port,url=url) - try: - httpClient = httplib.HTTPConnection(host, port, timeout=30) - httpClient.request("GET", url) - response = httpClient.getresponse() - if response.status/100 == 2: - result = json.loads(response.rad())["data"] - except Exception, e: - pass - finally: - if httpClient: - httpClient.close() - - return result - -def usage(): - print "-h hostname | -x" - -if __name__ == "__main__": - opts, args = getopt.getopt(sys.argv[1:], "xh:p:") - host = "" - port = "" - for op, value in opts: - if op == "-h": - host = value - if op == "-p": - port = value - elif op == "-x": - usage() - sys.exit() - - if len(host) <= 0 or len(port)<=0 : - print "bad args" - sys.exit() - - print update_index(host, port, urlUpdateAllFmt) diff --git a/index/index_update_all_task.go b/index/index_update_all_task.go index 33dde0b..7cfc103 100644 --- a/index/index_update_all_task.go +++ b/index/index_update_all_task.go @@ -3,10 +3,10 @@ package index import ( "encoding/json" "fmt" - cron "github.com/niean/cron" - nhttpclient "github.com/niean/gotools/http/httpclient" "github.com/open-falcon/task/g" "github.com/open-falcon/task/proc" + cron "github.com/toolkits/cron" + nhttpclient "github.com/toolkits/http/httpclient" "io/ioutil" "log" "net/http" diff --git a/monitor/monitor.go b/monitor/monitor.go index 82503a8..3a87ffb 100644 --- a/monitor/monitor.go +++ b/monitor/monitor.go @@ -3,13 +3,13 @@ package monitor import ( "bytes" "fmt" - ncron "github.com/niean/cron" - nsema "github.com/niean/gotools/concurrent/semaphore" - nmap "github.com/niean/gotools/container/nmap" - nhttpclient "github.com/niean/gotools/http/httpclient" - ntime "github.com/niean/gotools/time" "github.com/open-falcon/task/g" "github.com/open-falcon/task/proc" + nsema "github.com/toolkits/concurrent/semaphore" + nmap "github.com/toolkits/container/nmap" + ncron "github.com/toolkits/cron" + nhttpclient "github.com/toolkits/http/httpclient" + ntime "github.com/toolkits/time" "io/ioutil" "log" "net/http" diff --git a/proc/proc.go b/proc/proc.go index bb0ed98..fc2d0f3 100644 --- a/proc/proc.go +++ b/proc/proc.go @@ -1,7 +1,7 @@ package proc import ( - nproc "github.com/niean/gotools/proc" + nproc "github.com/toolkits/proc" "log" "time" )