git://git.onelab.eu
/
monitor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
36067ab
)
convert GetNodeNetworks to GetInterfaces and nodenetwork_ids to interface_ids
author
Stephen Soltesz
<soltesz@cs.princeton.edu>
Fri, 1 May 2009 19:17:39 +0000
(19:17 +0000)
committer
Stephen Soltesz
<soltesz@cs.princeton.edu>
Fri, 1 May 2009 19:17:39 +0000
(19:17 +0000)
13 files changed:
getsshkeys.py
patch
|
blob
|
history
monitor/bootman.py
patch
|
blob
|
history
monitor/getsshkeys.py
patch
|
blob
|
history
monitor/nodeconfig.py
patch
|
blob
|
history
monitor/wrapper/plc.py
patch
|
blob
|
history
monitor/wrapper/plccache.py
patch
|
blob
|
history
nagios/plc2nagios.py
patch
|
blob
|
history
nodeconfig.py
patch
|
blob
|
history
prep_power_users.py
patch
|
blob
|
history
testapi.py
patch
|
blob
|
history
tests/bwlimit.py
patch
|
blob
|
history
tests/nodenetwork.py
patch
|
blob
|
history
zabbix/zabbixsync.py
patch
|
blob
|
history
diff --git
a/getsshkeys.py
b/getsshkeys.py
index
d362c94
..
7b74759
100755
(executable)
--- a/
getsshkeys.py
+++ b/
getsshkeys.py
@@
-135,15
+135,15
@@
class SSHKnownHosts:
if type(host) == type(""): host = [host]
# get the node(s) info
if type(host) == type(""): host = [host]
# get the node(s) info
- nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","
nodenetwork
_ids"])
+ nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","
interface
_ids"])
# for each node's node network, update the self.nodenetworks cache
nodenetworks = []
for node in nodes:
# for each node's node network, update the self.nodenetworks cache
nodenetworks = []
for node in nodes:
- for net in node["
nodenetwork
_ids"]:
+ for net in node["
interface
_ids"]:
nodenetworks.append(net)
nodenetworks.append(net)
- plcnodenetworks = self.api.Get
NodeNetwork
s(self.auth,nodenetworks,["nodenetwork_id","ip"])
+ plcnodenetworks = self.api.Get
Interface
s(self.auth,nodenetworks,["nodenetwork_id","ip"])
for n in plcnodenetworks:
self.nodenetworks[n["nodenetwork_id"]]=n
return nodes
for n in plcnodenetworks:
self.nodenetworks[n["nodenetwork_id"]]=n
return nodes
@@
-152,10
+152,10
@@
class SSHKnownHosts:
host = node['hostname']
key = node['ssh_rsa_key']
host = node['hostname']
key = node['ssh_rsa_key']
- nodenetworks = node['
nodenetwork
_ids']
+ nodenetworks = node['
interface
_ids']
if len(nodenetworks)==0: return (host, None, None, None)
if len(nodenetworks)==0: return (host, None, None, None)
- # the [0] subscript to node['
nodenetwork
_ids'] means
+ # the [0] subscript to node['
interface
_ids'] means
# that this function wont work with multihomed nodes
l_nw = self.nodenetworks.get(nodenetworks[0],None)
if l_nw is None: return (host, None, None, None)
# that this function wont work with multihomed nodes
l_nw = self.nodenetworks.get(nodenetworks[0],None)
if l_nw is None: return (host, None, None, None)
diff --git
a/monitor/bootman.py
b/monitor/bootman.py
index
effd750
..
bfb295c
100755
(executable)
--- a/
monitor/bootman.py
+++ b/
monitor/bootman.py
@@
-813,7
+813,7
@@
def restore(sitehist, hostname, config=None, forced_action=None):
args = {}
try:
node = plccache.GetNodeByName(hostname)
args = {}
try:
node = plccache.GetNodeByName(hostname)
- net = api.Get
NodeNetworks(node['nodenetwork
_ids'])[0]
+ net = api.Get
Interfaces(node['interface
_ids'])[0]
except:
email_exception()
print traceback.print_exc()
except:
email_exception()
print traceback.print_exc()
diff --git
a/monitor/getsshkeys.py
b/monitor/getsshkeys.py
index
1068c5f
..
7b7d271
100755
(executable)
--- a/
monitor/getsshkeys.py
+++ b/
monitor/getsshkeys.py
@@
-135,15
+135,15
@@
class SSHKnownHosts:
if type(host) == type(""): host = [host]
# get the node(s) info
if type(host) == type(""): host = [host]
# get the node(s) info
- nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","
nodenetwork
_ids"])
+ nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","
interface
_ids"])
# for each node's node network, update the self.nodenetworks cache
nodenetworks = []
for node in nodes:
# for each node's node network, update the self.nodenetworks cache
nodenetworks = []
for node in nodes:
- for net in node["
nodenetwork
_ids"]:
+ for net in node["
interface
_ids"]:
nodenetworks.append(net)
nodenetworks.append(net)
- plcnodenetworks = self.api.Get
NodeNetwork
s(self.auth,nodenetworks,["nodenetwork_id","ip"])
+ plcnodenetworks = self.api.Get
Interface
s(self.auth,nodenetworks,["nodenetwork_id","ip"])
for n in plcnodenetworks:
self.nodenetworks[n["nodenetwork_id"]]=n
return nodes
for n in plcnodenetworks:
self.nodenetworks[n["nodenetwork_id"]]=n
return nodes
@@
-152,10
+152,10
@@
class SSHKnownHosts:
host = node['hostname']
key = node['ssh_rsa_key']
host = node['hostname']
key = node['ssh_rsa_key']
- nodenetworks = node['
nodenetwork
_ids']
+ nodenetworks = node['
interface
_ids']
if len(nodenetworks)==0: return (host, None, None, None)
if len(nodenetworks)==0: return (host, None, None, None)
- # the [0] subscript to node['
nodenetwork
_ids'] means
+ # the [0] subscript to node['
interface
_ids'] means
# that this function wont work with multihomed nodes
l_nw = self.nodenetworks.get(nodenetworks[0],None)
if l_nw is None: return (host, None, None, None)
# that this function wont work with multihomed nodes
l_nw = self.nodenetworks.get(nodenetworks[0],None)
if l_nw is None: return (host, None, None, None)
diff --git
a/monitor/nodeconfig.py
b/monitor/nodeconfig.py
index
6a23fb7
..
bb66176
100755
(executable)
--- a/
monitor/nodeconfig.py
+++ b/
monitor/nodeconfig.py
@@
-39,7
+39,7
@@
def main():
try:
n = api.GetNodes(node)[0]
#print n
try:
n = api.GetNodes(node)[0]
#print n
- net = api.Get
NodeNetworks(n['nodenetwork
_ids'])[0]
+ net = api.Get
Interfaces(n['interface
_ids'])[0]
#print net
node_keys = ['boot_state', 'key', 'last_updated', 'last_contact']
#print net
node_keys = ['boot_state', 'key', 'last_updated', 'last_contact']
diff --git
a/monitor/wrapper/plc.py
b/monitor/wrapper/plc.py
index
2f0f19d
..
8f70c1f
100644
(file)
--- a/
monitor/wrapper/plc.py
+++ b/
monitor/wrapper/plc.py
@@
-301,14
+301,14
@@
def getSiteNodes2(loginbase):
def getNodeNetworks(filter=None):
api = xmlrpclib.Server(auth.server, verbose=False, allow_none=True)
def getNodeNetworks(filter=None):
api = xmlrpclib.Server(auth.server, verbose=False, allow_none=True)
- nodenetworks = api.Get
NodeNetwork
s(auth.auth, filter, None)
+ nodenetworks = api.Get
Interface
s(auth.auth, filter, None)
return nodenetworks
def getNodes(filter=None, fields=None):
api = xmlrpclib.Server(auth.server, verbose=False, allow_none=True)
nodes = api.GetNodes(auth.auth, filter, fields)
#['boot_state', 'hostname',
return nodenetworks
def getNodes(filter=None, fields=None):
api = xmlrpclib.Server(auth.server, verbose=False, allow_none=True)
nodes = api.GetNodes(auth.auth, filter, fields)
#['boot_state', 'hostname',
- #'site_id', 'date_created', 'node_id', 'version', '
nodenetwork
_ids',
+ #'site_id', 'date_created', 'node_id', 'version', '
interface
_ids',
#'last_updated', 'peer_node_id', 'ssh_rsa_key' ])
return nodes
#'last_updated', 'peer_node_id', 'ssh_rsa_key' ])
return nodes
diff --git
a/monitor/wrapper/plccache.py
b/monitor/wrapper/plccache.py
index
dc62d0d
..
de054dc
100755
(executable)
--- a/
monitor/wrapper/plccache.py
+++ b/
monitor/wrapper/plccache.py
@@
-139,7
+139,7
@@
def sync():
l_nodes = plc.api.GetNodes({'peer_id':None},
['hostname', 'node_id', 'ports', 'site_id', 'boot_state',
'version', 'last_updated', 'date_created', 'key',
l_nodes = plc.api.GetNodes({'peer_id':None},
['hostname', 'node_id', 'ports', 'site_id', 'boot_state',
'version', 'last_updated', 'date_created', 'key',
- 'last_contact', 'pcu_ids', '
nodenetwork
_ids'])
+ 'last_contact', 'pcu_ids', '
interface
_ids'])
l_pcus = plc.api.GetPCUs()
print "sync sites"
l_pcus = plc.api.GetPCUs()
print "sync sites"
diff --git
a/nagios/plc2nagios.py
b/nagios/plc2nagios.py
index
d7da592
..
de74d42
100755
(executable)
--- a/
nagios/plc2nagios.py
+++ b/
nagios/plc2nagios.py
@@
-97,10
+97,10
@@
for site in plcdb:
for node in nodes:
hn = node['hostname']
for node in nodes:
hn = node['hostname']
- if len(node['
nodenetwork
_ids']) == 0:
+ if len(node['
interface
_ids']) == 0:
continue
continue
- ip = netid2ip[node['
nodenetwork
_ids'][0]]
+ ip = netid2ip[node['
interface
_ids'][0]]
if lon_x is not -1 and lat_y is not -1:
coords="%s,%s" % (lon_x, lat_y)
if lon_x is not -1 and lat_y is not -1:
coords="%s,%s" % (lon_x, lat_y)
diff --git
a/nodeconfig.py
b/nodeconfig.py
index
6a23fb7
..
bb66176
100755
(executable)
--- a/
nodeconfig.py
+++ b/
nodeconfig.py
@@
-39,7
+39,7
@@
def main():
try:
n = api.GetNodes(node)[0]
#print n
try:
n = api.GetNodes(node)[0]
#print n
- net = api.Get
NodeNetworks(n['nodenetwork
_ids'])[0]
+ net = api.Get
Interfaces(n['interface
_ids'])[0]
#print net
node_keys = ['boot_state', 'key', 'last_updated', 'last_contact']
#print net
node_keys = ['boot_state', 'key', 'last_updated', 'last_contact']
diff --git
a/prep_power_users.py
b/prep_power_users.py
index
8e0219e
..
c14690e
100755
(executable)
--- a/
prep_power_users.py
+++ b/
prep_power_users.py
@@
-134,7
+134,7
@@
for email in email_list:
'model': node['model'],
'hostname' : node['hostname'],
'version' : node['version']})
'model': node['model'],
'hostname' : node['hostname'],
'version' : node['version']})
- nnets = api.Get
NodeNetworks(node['nodenetwork
_ids'])
+ nnets = api.Get
Interfaces(node['interface
_ids'])
for nnet in nnets:
del nnet['nodenetwork_id']
del nnet['nodenetwork_setting_ids']
for nnet in nnets:
del nnet['nodenetwork_id']
del nnet['nodenetwork_setting_ids']
diff --git
a/testapi.py
b/testapi.py
index
d60effb
..
530677f
100755
(executable)
--- a/
testapi.py
+++ b/
testapi.py
@@
-13,7
+13,7
@@
try:
site_nodes = api.GetNodes(site['node_ids'])
site_people = api.GetPersons(site['person_ids'])
for node in site_nodes:
site_nodes = api.GetNodes(site['node_ids'])
site_people = api.GetPersons(site['person_ids'])
for node in site_nodes:
- network = api.Get
NodeNetworks(node['nodenetwork
_ids'])
+ network = api.Get
Interfaces(node['interface
_ids'])
print "ok"
except:
sys.stderr.write(traceback.format_exc())
print "ok"
except:
sys.stderr.write(traceback.format_exc())
diff --git
a/tests/bwlimit.py
b/tests/bwlimit.py
index
6b93156
..
bd24f49
100755
(executable)
--- a/
tests/bwlimit.py
+++ b/
tests/bwlimit.py
@@
-19,8
+19,8
@@
def main():
for h in d_nodes:
host = d_nodes[h]
for h in d_nodes:
host = d_nodes[h]
- for nw_id in host['
nodenetwork
_ids']:
- l_nw = plc.getNodeNetworks({'nodenetwork_id': host['
nodenetwork
_ids']})
+ for nw_id in host['
interface
_ids']:
+ l_nw = plc.getNodeNetworks({'nodenetwork_id': host['
interface
_ids']})
bwlimit[h] = []
for nw in l_nw:
if nw['bwlimit'] != None and nw['bwlimit'] < 500000:
bwlimit[h] = []
for nw in l_nw:
if nw['bwlimit'] != None and nw['bwlimit'] < 500000:
diff --git
a/tests/nodenetwork.py
b/tests/nodenetwork.py
index
5c1a439
..
63d1700
100755
(executable)
--- a/
tests/nodenetwork.py
+++ b/
tests/nodenetwork.py
@@
-8,9
+8,9
@@
import util.file
if len(sys.argv[1:]) > 0:
for host in sys.argv[1:]:
n = api.GetNodes(host)[0]
if len(sys.argv[1:]) > 0:
for host in sys.argv[1:]:
n = api.GetNodes(host)[0]
- nn = api.Get
NodeNetworks(n['nodenetwork
_ids'])
+ nn = api.Get
Interfaces(n['interface
_ids'])
for nodenet in nn:
for nodenet in nn:
- nnet2 = api.Get
NodeNetwork
s({'ip': nodenet['ip']})
+ nnet2 = api.Get
Interface
s({'ip': nodenet['ip']})
print "len of nn entries with ip: %s == %s " % ( nodenet['ip'], len(nnet2) )
for nn2 in nnet2:
n2 = api.GetNodes(nn2['node_id'])
print "len of nn entries with ip: %s == %s " % ( nodenet['ip'], len(nnet2) )
for nn2 in nnet2:
n2 = api.GetNodes(nn2['node_id'])
@@
-27,13
+27,13
@@
else:
nnids = util.file.getListFromFile('nnids.txt')
nnids = [ int(i) for i in nnids]
for id in nnids:
nnids = util.file.getListFromFile('nnids.txt')
nnids = [ int(i) for i in nnids]
for id in nnids:
- nnet2 = api.Get
NodeNetwork
s(id)
+ nnet2 = api.Get
Interface
s(id)
for nn2 in nnet2:
n2 = api.GetNodes(nn2['node_id'])
if len(n2) == 0 :
print "\t%d node is attached to nodenetwork %s %s" % ( len(n2), nn2['nodenetwork_id'] , nn2['ip']),
for nn2 in nnet2:
n2 = api.GetNodes(nn2['node_id'])
if len(n2) == 0 :
print "\t%d node is attached to nodenetwork %s %s" % ( len(n2), nn2['nodenetwork_id'] , nn2['ip']),
- netlist = api.Get
NodeNetwork
s({'ip' : nn2['ip']})
+ netlist = api.Get
Interface
s({'ip' : nn2['ip']})
if len(netlist) != 1:
node_len = len([ n['node_id'] for n in netlist])
print "\t but, ip %s is used by %s nodenetwork entries" % (nn2['ip'], node_len)
if len(netlist) != 1:
node_len = len([ n['node_id'] for n in netlist])
print "\t but, ip %s is used by %s nodenetwork entries" % (nn2['ip'], node_len)
diff --git
a/zabbix/zabbixsync.py
b/zabbix/zabbixsync.py
index
aaee4ff
..
407d801
100755
(executable)
--- a/
zabbix/zabbixsync.py
+++ b/
zabbix/zabbixsync.py
@@
-22,8
+22,8
@@
def get_site_iplist(loginbase):
# TODO: if it is, then we need to break up the discovery rule.
ip_list = ""
for node in node_list:
# TODO: if it is, then we need to break up the discovery rule.
ip_list = ""
for node in node_list:
- if len(node['
nodenetwork
_ids']) > 0:
- ip = netid2ip[node['
nodenetwork
_ids'][0]]
+ if len(node['
interface
_ids']) > 0:
+ ip = netid2ip[node['
interface
_ids'][0]]
if len(ip_list) > 0: ip_list += ","
ip_list += ip
if len(ip_list) > 0: ip_list += ","
ip_list += ip