Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Benjamin Dill

#31
General Support / Centralized package mangement
September 24, 2014, 09:22:56 PM
I'm currently thinking about using NetXMS for centralized package management. My idea is to collect information of some client based package manager like chocolatey under Windows or apt under Linux and control the packages in NetXMS. I'm talking about smaller networks which don't need a full-blown software distribution solution, just a simple possibility for installing, uninstalling and updating packages on some or all systems in the network.

For that purpose some additions in management console and agent would be helpful:
- I think NetXMS shouldn't reinvent something new for what concerns the actual package management on the client. A generic interface (in form of some additional config parameters in the agent configuration) would be enough, calling external commands for collecting installed packages, installing a package, updating etc. This can already be done using config parameters ExternalList or ExternalParam.
- A policy for software packages like the existing one for agent configuration, which automatically installs and updates the defined packages on nodes. Maybe right now possible using actions and some external scripts, but I definitivly don't want to do that.
- A few overviews which show the actual package status on one and many nodes. I don't think this is possible right now.
- Some context menu options for quick install and uninstall would be nice. Available through object tools at the moment.

What do you think?
#32
General Support / Re: Software inventory
September 22, 2014, 12:18:42 PM
Some funny note on that: Even the NetXMS client is currently not listed  :)
I will take a look if I can fix that.
#33
General Support / Re: Agent Authentication
September 22, 2014, 02:04:42 AM
Hi,

config option SharedSecret is always in clear text. There is an additional option EncryptedSharedSecret for that porpose.
See also here http://wiki.netxms.org/wiki/Agent_Configuration_File.

Best wishes,
Ben
#34
General Support / Re: Agent Actions parameters not working
September 21, 2014, 08:22:25 PM
--- "a/C:\\Users\\VS2005\\AppData\\Local\\Temp\\TortoiseGit\\ses76AB.tmp\\session-b45e65c-left.cpp"
+++ "b/C:\\Code\\netxms-v1.2.16\\src\\server\\core\\session.cpp"
@@ -7269,7 +7269,15 @@ void ClientSession::executeAction(CSCPMessage *pRequest)
             if (pConn != NULL)
             {
                pRequest->GetVariableStr(VID_ACTION_NAME, szAction, MAX_PARAM_NAME);
-               dwResult = pConn->execAction(szAction, 0, NULL);
+    int argc = pRequest->getFieldAsInt32(VID_NUM_ARGS);
+    TCHAR **argv = new TCHAR*[argc];
+    for (int i = 0; i < argc; i++)
+    {
+    argv[i] = new TCHAR[256];
+    pRequest->GetVariableStr(VID_ACTION_ARG_BASE + i, argv[i], 256);
+    }
+               dwResult = pConn->execAction(szAction, argc, argv);
+    free(argv);

                switch(dwResult)
                {


--- "a/C:\\Users\\VS2005\\AppData\\Local\\Temp\\TortoiseGit\\NXC2518.tmp\\NXCSession-b45e65c-left.java"
+++ "b/C:\\Code\\netxms-v1.2.16\\src\\java\\netxms-client\\src\\main\\java\\org\\netxms\\client\\NXCSession.java"
@@ -4408,14 +4408,21 @@ public NetworkMapPage queryLayer2Topology(final long nodeId) throws IOException,
     *
     * @param nodeId Node object ID
     * @param action Action name
+    * @param args Action arguments
     * @throws IOException  if socket I/O error occurs
     * @throws NXCException if NetXMS server returns an error or operation was timed out
     */
-   public void executeAction(final long nodeId, final String action) throws IOException, NXCException
+   public void executeAction(final long nodeId, final String action, String[] args) throws IOException, NXCException
    {
       NXCPMessage msg = newMessage(NXCPCodes.CMD_EXECUTE_ACTION);
       msg.setVariableInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
       msg.setVariable(NXCPCodes.VID_ACTION_NAME, action);
+      if (args != null)
+      {
+       msg.setVariableInt32(NXCPCodes.VID_NUM_ARGS, args.length);
+       for (int i=0; i<args.length; i++)
+       msg.setVariable(NXCPCodes.VID_ACTION_ARG_BASE + i, args[i]);
+      }
       sendMessage(msg);
       waitForRCC(msg.getMessageId());
    }


--- "a/C:\\Users\\VS2005\\AppData\\Local\\Temp\\TortoiseGit\\Obj1C3B.tmp\\ObjectToolExecutor-b45e65c-left.java"
+++ "b/C:\\Code\\netxms-v1.2.16\\src\\java\\netxms-eclipse\\ObjectTools\\src\\org\\netxms\\ui\\eclipse\\objecttools\\api\\ObjectToolExecutor.java"
@@ -173,8 +173,30 @@ private static void executeTableTool(final NodeInfo node, final ObjectTool tool)
     */
    private static void executeAgentAction(final NodeInfo node, final ObjectTool tool)
    {
-      final NXCSession session = (NXCSession)ConsoleSharedData.getSession();
-      final String action = substituteMacros(tool.getData(), node);
+   final NXCSession session = (NXCSession)ConsoleSharedData.getSession();
+   String _action = substituteMacros(tool.getData(), node);
+  
+   if (_action.endsWith("(*)"))
+   {
+ InputDialog dlg = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ Messages.get().ObjectToolsDynamicMenu_Information, "Parameter", "", null); //$NON-NLS-1$
+ if (dlg.open() != Window.OK)
+ return;
+
+ _action = _action.replace("(*)", "(" + dlg.getValue() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+   }
+      
+      String[] _args = null;
+      if (_action.indexOf('(') > 0)
+      {
+      String a = _action.substring(_action.indexOf('(') + 1, _action.length() - 1);
+      _args = a.split(",");
+      for (int i = 0; i < _args.length; i++) _args[i] = _args[i].trim();
+      _action = _action.substring(0, _action.indexOf('(') + 1) + "*)";
+      }
+      final String action = _action;
+      final String[] args = _args;
+     
       new ConsoleJob(String.format(Messages.get().ObjectToolsDynamicMenu_ExecuteOnNode, node.object.getObjectName()), null, Activator.PLUGIN_ID, null) {
          @Override
          protected String getErrorMessage()
@@ -185,7 +207,7 @@ protected String getErrorMessage()
          @Override
          protected void runInternal(IProgressMonitor monitor) throws Exception
          {
-            session.executeAction(node.object.getObjectId(), action);
+            session.executeAction(node.object.getObjectId(), action, args);
             runInUIThread(new Runnable() {
                @Override
                public void run()
#35
General Support / Re: Agent Actions parameters not working
September 21, 2014, 06:33:06 PM
I've fixed this. After I fixed it I found out that the server doesn't pass the parameters to the agent, so I had to fix this to.
And while I were at it I also added a dialog for passing parameters when invoking the action when (*) is used in action name  :)

Victor, can I provide you the code in any way or do want to fix it yourself?

Best whishes,
Ben