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

#61
General Support / File copy to agent
August 19, 2015, 03:20:31 PM
Hello,

I have a some powershell scripts which i use on windows agents by the ExternalParameter or ExternalList-options. This works quite well, but currently I copy these scripts manually to the agents data folder.
Is it possible that that agent automatically loads additional files in its data folder? I guess the configuration poll hook would be a good place for such an "action", but I can't find any info how to upload or download a file to the agent by NXSL.
Or is there even a simpler method to copy files from server to agent for some library files?

Regards,
Ben
#62
I've used this solution in past and it works very well.
Actually I've added an ExternalList, so the available sensors can be discovered by instance discovery.




Line in Agent config file:
ExternalList = OpenHardwareMonitor.Sensors:powershell -NonInteractive -Command "& { get-wmiobject -namespace root\OpenHardwareMonitor -query 'select * from Sensor' | foreach { $$_.InstanceId } }"



WMI.Query(root\OpenHardwareMonitor,"select * from Sensor where InstanceId='{instance}'",Value)



SensorType = AgentReadParameter($node, "WMI.Query(root\OpenHardwareMonitor,\"select * from Sensor where InstanceId='" . $1 . "'\",SensorType)");
Name = AgentReadParameter($node, "WMI.Query(root\OpenHardwareMonitor,\"select * from Sensor where InstanceId='" . $1 . "'\",Name)");
Identifier = AgentReadParameter($node, "WMI.Query(root\OpenHardwareMonitor,\"select * from Sensor where InstanceId='" . $1 . "'\",Identifier)");

return %(SensorType == "Temperature", $1, Name . "  [" . Identifier . "]");
#63
Feature Requests / Cluster resource assignment
August 11, 2015, 07:07:54 PM
Hi,

I'm currently struggling about monitoring clusters.
For example I'd like to add a cluster container with some Hyper-V cluster nodes. On the cluster "Last Values" tab I'd like to have the CPU usage of all virtual machines hosted by the cluster. Intuitively I'd like to add each virtual machine to the cluster's resources, but here starts my problem: I guess cluster resources are assigned to cluster nodes by MAC address match? I don't know how to do that with virtual machines...
My wish would be that the owner of cluster resources can be assigned by script execution, not only by virtual IP. It would be easy to determine the hosting cluster node of a virtual machine by a wmi query. Also there would be may more possibilities using cluster resources, which currently I rarely use...
#64
Announcements / Re: NetXMS 2.0-M5 released
June 21, 2015, 04:16:32 PM
Hello Victor,

the Windows client keeps crashing immediatly after it is contactad by the server. It happens on all machines. I reverted the client to 2.0-M4 which runs without any problems.
#65
Announcements / Re: NetXMS 1.2.16 released
September 27, 2014, 09:31:14 PM
It seems there are still some database issues. I did a fresh install with a new database today (Windows x64, MSSQL) and netxmsd keeps crashing after installation. Then I installed 1.2.14 and did an upgrade to 1.2.16, which worked without any problems.
#66
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?
#67
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.
#68
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
#69
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()
#70
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