AutoPatrol, Bureaucrats, Administrators
683
edits
Line 70: | Line 70: | ||
== Change Object comments == | == Change Object comments == | ||
< | <syntaxhighlight lang="python"> | ||
for name in open("nodes.txt").readlines(): | |||
node = session.findObjectByName(name.strip()) | node = session.findObjectByName(name.strip()) | ||
if node: | if node: | ||
Line 78: | Line 79: | ||
comments += "\n" + existingComments | comments += "\n" + existingComments | ||
session.updateObjectComments(node.getObjectId(), comments) | session.updateObjectComments(node.getObjectId(), comments) | ||
</ | </syntaxhighlight> | ||
== Manage / Unmanage interfaces based on the name == | == Manage / Unmanage interfaces based on the name == | ||
(works for any Object). | (works for any Object). | ||
< | <syntaxhighlight lang="python"> | ||
from org.netxms.client.objects import GenericObject, Node, Interface | |||
for name in open("nodes.txt").readlines(): | for name in open("nodes.txt").readlines(): | ||
Line 93: | Line 95: | ||
else: | else: | ||
session.setObjectManaged(interface.getObjectId(), False) | session.setObjectManaged(interface.getObjectId(), False) | ||
</ | </syntaxhighlight> | ||
== Disable SNMP polling for node == | == Disable SNMP polling for node == | ||
< | <syntaxhighlight lang="python"> | ||
from org.netxms.client.objects import Node | |||
for name in open("nodes.txt").readlines(): | for name in open("nodes.txt").readlines(): | ||
Line 105: | Line 108: | ||
md.setObjectFlags(newFlags) | md.setObjectFlags(newFlags) | ||
session.modifyObject(md) | session.modifyObject(md) | ||
</ | </syntaxhighlight> |