Hello.
After couple of requests we made a small tool to help automate operations, which are currently available only thru user interface or java api. In essence, it's wrapper around Jython (Java implementation of Python) and NetXMS API, with some glue in between to make it easier to use.
More details in our Wiki: http://wiki.netxms.org/wiki/Using_nxshell_to_automate_bulk_operations
Hello Alex.
Thanks for this tool, I'm very interested in trying it.
Is it possible to automate any task we can be done by console?
Is there available other sample scripts in addition to the one in the wiki?
Best regards.
Yes, all operations done by GUI can be done using API. Right now it's just a raw Java API with some glue for more convenient use, but I plan to make it more Python-ish.
I can add more samples – do you have any particular idea in mind?
I had planned to read nodes from a file and check if exist in certain containers. If they did not exist would be created and then:
- Modify some node properties: polling options, comments, custom attributes, calculation status, etc.
- Manage network interfaces only having a certain name, others unmanaged.
- Create DCI for managed interfaces.
- Edit some properties for the previous DCIs (description, transformation, thresholds, etc..)
- Create other DCI for node (MTBF & MTTR -https://www.netxms.org/forum/general-support/mtbf-%28mean-time-between-failures%29-and-mttr-%28mean-time-to-repair%29/msg8953/#msg8953-, etc.)
All this for about 400 nodes :-[.
Best regards.
Quote from: testos on January 31, 2013, 07:18:33 PM
- Modify some node properties: polling options, comments, custom attributes, calculation status, etc.
- Edit some properties for the previous DCIs (description, transformation, thresholds, etc..)
y can do this with sql query
I've added couple more samples to Wiki (http://wiki.netxms.org/wiki/Using_nxshell_to_automate_bulk_operations#Sample_Scripts)
Thank you very much for your support, it is just what I needed.
nxshell opens a world of great possibilities for large environments!
Best regards.
Hi Alex.
I'm trying NetXMS 1.2.5 Interactive Shell and and I can see it's a nice tool. It is much easier any automatic bulk operation.
QuoteNetXMS 1.2.5 Interactive Shell
>>> help()
Welcome to Python 2.5! This is the online help utility.
But Interactive Shell use python 2.5 vesion and the latest current production versions is Python 3.3.0
I'm trying to modify nxshell-1.2.5.jar contents to replace the lib directory from 3.3.0 version, but then I get an error in org.python.core
How can I upgrade python shell to 3.3.0 version?
I need to import some Python modules which only work with 2.7 version and later.
Best regards.
It's build around Jython which is 2.5.4 right now (not CPython, which is 3.3.0 right now), 2.7 is in beta stage.
I've did couple of quick tests with 2.7-beta1 version and it seems to work fine. You can try this jar: https://netxms.org/nxshell-1.2.5_jython27.jar.
Hi Alex.
Thanks for the upgrade to 2.7 version and for the Jython versions clarification. Now I can add current versions of modules I need. It is also possible to list all availables modules (in the previous version modules command gave me an error):
QuoteNetXMS 1.2.6 Interactive Shell
>>> import xlrd
>>> help()
Welcome to Python 2.7! This is the online help utility.
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".
To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".
help> modules
Please wait a moment while I gather a list of all available modules...
BaseHTTPServer codecs jffi sched
CGIHTTPServer codeop json select
ConfigParser collections keyword sets
Cookie colorsys linecache setuptools
DocXMLRPCServer command locale sgmllib
HTMLParser commands logging sha
MimeWriter compileall macpath shelve
Queue compiler macurl2path shlex
SimpleHTTPServer contextlib mailbox shutil
SimpleXMLRPCServer cookielib mailcap signal
SocketServer copy markupbase site
StringIO copy_reg marshal smtpd
UserDict csv math smtplib
UserList ctypes md5 sndhdr
UserString datetime mhlib socket
_LWPCookieJar dbexts mime sre
_MozillaCookieJar decimal mimetools sre_compile
__builtin__ difflib mimetypes sre_constants
__future__ dircache mimify sre_parse
_abcoll dis modjy ssl
_ast distutils multifile stat
_codecs doctest mutex string
_collections dom netrc struct
_csv dumbdbm new subprocess
_fsum dummy_thread nntplib symbol
_functools dummy_threading nt synchronize
_google_ipaddr_r234 easy_install ntpath sys
_hashlib email nturl2path sysconfig
_io encodings numbers tabnanny
_jyio errno opcode tarfile
_marshal etree operator telnetlib
_py_compile exceptions optparse tempfile
_pyio filecmp os test
_random fileinput parsers tests
_rawffi fnmatch pawt textwrap
_sre formatter pdb this
_strptime fpformat pickle thread
_systemrestart fractions pickletools threading
_threading ftplib pipes time
_threading_local functools pkg_resources timeit
_warnings future_builtins pkgutil token
_weakref gc platform tokenize
_weakrefset genericpath plistlib trace
abc getopt popen2 traceback
aifc getpass poplib tty
anydbm gettext posixfile types
argparse glob posixpath ucnhash
array grp pprint unicodedata
ast gzip profile unittest
asynchat hashlib pstats urllib
asyncore heapq pty urllib2
atexit hmac pwd urlparse
base64 htmlentitydefs py_compile user
bdb htmllib pycimport uu
binascii httplib pyclbr uuid
binhex ihooks pydoc warnings
bisect imaplib pyexpat weakref
bz2 imghdr quopri whichdb
cPickle imp random wsgiref
cStringIO importlib re xdrlib
calendar inspect readline xlrd
cgi io repr xml
cgitb isql rfc822 xmllib
chunk itertools rlcompleter xmlrpclib
cmath jarray robotparser zipfile
cmd javapath runpy zipimport
code javashell sax zlib
Enter any module name to get more help. Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".
help>
I will continue testing this good tool...