From ec90cc34f6ce637998644dc63699a8cc21408d1a Mon Sep 17 00:00:00 2001 From: vfuse Date: Wed, 26 Apr 2017 13:42:00 +0200 Subject: [PATCH] Added option to preset serverid --- nixstatsagent/nixstatsagent.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nixstatsagent/nixstatsagent.py b/nixstatsagent/nixstatsagent.py index f0e7eab..3975cdc 100755 --- a/nixstatsagent/nixstatsagent.py +++ b/nixstatsagent/nixstatsagent.py @@ -27,7 +27,7 @@ import urllib2 -__version__ = '1.1.12' # App version +__version__ = '1.1.13' # App version __FILEABSDIRNAME__ = os.path.dirname(os.path.abspath(__file__)) @@ -68,7 +68,10 @@ def hello(proto='https'): token_filename = sys.argv[2] else: token_filename = os.path.join(__FILEABSDIRNAME__, 'nixstats-token.ini') - if os.path.isfile('/etc/nixstats/token'): + if '_' in user_id: + user_id = user_id.split('_')[0] + server_id = user_id.split('_')[1] + elif os.path.isfile('/etc/nixstats/token'): oldconfigfile = open('/etc/nixstats/token','r') server_id = oldconfigfile.readline() print "Upgrading from old monitoring agent"