Cybersecurity
DevOps Cloud (ADM)
IT Operations Cloud
ZENworks Configuration Management supports the enforcement of SNMP policy on managed devices. SNMP policy is useful to configure SNMP Trap, SNMP Community Strings and the SNMP Hosts list. In ZCM, a default System Requirement is set on this policy which ensures that the policy is effective only on those devices which have the SNMP service installed.
It is quite often possible that on a managed device such as Windows XP, the SNMP service does not get installed by default when the Operating System is installed. In order to get the SNMP service installed on all the devices automatically, the Administrator can make use of the Directive Bundles provided by ZENworks Configuration Management.
Navigate to the Bundles Page of the ZENworks Control Center and then click New -> Bundle. Select the Directive Bundle Option and click Next.
Provide the bundle name and click Next. Now, click Add -> Copy File(s) menu to add a new Copy File Action. In this action, provide the path (local or network) for a file named ‘ocm.txt’ which contains the following text:
[NetOptionalComponents]
SNMP = 1
Note: If SNMP = 1 is entered in the ocm.txt, SNMP Service will be installed and if SNMP = 0 is entered, then the already installed SNMP Service will be uninstalled.
Please refer to the following figures for creating the Copy File Action.
In case the path mentioned in Copy File action is not resolved by the managed device, then ocm.txt will not be copied to the device. The Administrators can alternatively use the File Bundle -> Install File(s) bundle to copy the ocm.txt file needed to install the SNMP Service.
For this, start creating an Install File(s) bundle and add the ocm.txt file (which would be uploaded to the content servers). Then provide the Destination Directory as “C:\”. Set the Copy Option to “Copy Always”. Refer to the following figures.
Alternatively you can choose to create an “Edit Text File” action and create a new ocm.txt file on the managed device with the above content.
The Administrator essentially needs to ensure that the ocm.txt file is made available in the managed device before executing the command described in the Run Script (or Launch Windows Executable) action in this document.
After the ocm.txt file has been copied to the specified directory in the managed device, create a Registry Edit action in the same Directive Bundle. Click Add -> Registry Edit to invoke the dialog.
In the Registry Edit Action, create the Keys and Values as shown in the figure below. Essentially this updates the following keys to a local or network path where the Operating System’s Source CD (i386) is available.
/HKLM/Software/Microsoft/Windows/CurrentVersion/Setup/SourcePath
/HKLM/Software/Microsoft/Windows/ CurrentVersion/Setup/ServicePackSourcePath
/HKLM/Software/Microsoft/WindowsNT/CurrentVersion/SourcePath
In the example shown below, the keys specified are created as Strings and the value is set to “xxx.xxx.xxx.xxx/Installables”. You can replace this value with the path where the source / i386 is made available in your network.
After the ocm.txt file has been copied to the device and the Registry Keys for Source Path have been properly updated, its now time to Run a script which launches the Windows Setup (sysocmgr.exe) to Install the SNMP Service as per the instructions set in the ocm.txt file.
Click on Add -> Run Script to invoke the Run Script dialog. In this dialog, select the option “Define Your Own Script” against the “Script To Run” attribute. Click the link “Edit” specified next to “Script Content” and then type in the following script :
%windir%\system32\sysocmgr.exe /i:%windir%\inf\sysoc.inf /u:c\ocm.txt /r /q
The above script invokes the Windows Setup to Add / Remove Windows Components, and looks for the file c:\ocm.txt to perform the specified actions. In this case, since SNMP = 1 is specified, it looks for the source / i386 file and installs the SNMP and SNMP Trap services on the Windows machine.
Refer to the following figures on how to configure the Run Script Action in the ZCM Directive Bundle.
Administrators can also use the Launch Windows Executable action instead of the Run Script action described above. Refer to the following figure to get a Launch Windows Executable action created.
The Administrators can also create a Start / Stop Service action for starting the SNMP (and / or SNMP Trap) Service on the Managed Device. Click Add -> Start / Stop Service to do so. Refer to the following figure on how to configure the Start Service action.
The final list of all the actions that are required to be included in the Directive Bundle for :
The following figure depicts the required set of actions for installing and starting the SNMP service on managed devices.
After the Directive Bundle is created as specified above, the Administrator can then Assign the Bundle to the required Device Folder or Device Group and refresh the same.
Upon assignment to the device, Refresh all the devices so that the bundle gets enforced and all the specified actions are triggered / launched on the managed device(s).
After all the actions have been successfully launched (and installed), the Administrators should be able to see the SNMP Service and SNMP Trap Service installed an Running on the device(s).
The Administrator can then create an SNMP policy to configure the SNMP Trap, SNMP Community Strings, Hosts list, etc., to get things working as per the requirements.
By using such a simple option provided by ZCM (viz., Directive Bundle and SNMP Policy), the Administrators can save a lot of time that might be required to Install, Start and Configure the SNMP / SNMP Trap Services on a large number of managed devices in the network.
Sincere thanks to Vikrant Kaul for having reviewed the article and providing valuable inputs. His feedback helped me improve the content of the article and also made it more user-friendly.