Using scripting and the Custom Monitor functionality in Monitis you can monitor not only system metrics but also how other resources are used.
To give an example we’ll use a scenario that involves an Active Directory security group used to grant access to a color printer on your print server. In your organization you may have several administrators and you want to maintain control on how resource access is granted. One way to establish this is to monitor he number of users in the security group and set up an alert when a user is added or removed from the monitored group.
Monitis API Access
The first thing you need when creating a custom monitor for the Monitis Dashboard is the Monitis API Key and Secret Key. The API Key is an alphanumeric code that allows you to access the Monitis API urls and transmit or receive data about your Monitis services. The Secret Key is an alphanumeric code that allows you to digitally sign your information to ensure that only you can transmit data to your Monitis account. Your API Key may be disclosed to anyone, but your Secret Key must be maintained private and should not be shared or transmitted.
To obtain your Monitis API Key and Secret Key, log into your account and from the top menu bar, select Tools / API / API Key. This will show both your API and Secret Key .
Create the Active Directory Custom Monitor
A Custom Monitor is needed to display the values you get from external sources.
In order to create it you need go through the following steps:
- Connect to Monits API and obtain an authorization token
- Create the Custom Monitor specific to the security group you wish to monitor.
The following VBScript code does it all for you:
Save this code to a file with a .vbs extension (such as createSecurityGroupCustMon.vbs) and save it, then run it executing the following command from a command prompt:
Uploading Active Directory Values to Custom Monitor
Once your custom monitor is created you can start uploading the necessary data to it. The following steps are needed:
- Connect to Monits API and obtain an authToken
- Get the list of Custom Monitors and locate the ID of the monitor we are working with
- Connect to Active Directory, locate the security group and enumerate the group members
- Upload the value to the Custom Monitor
The following script takes care of the steps outlined above:
Save this code to a file with a .vbs extension (such as pushSecurityGroupData.vbs) and save it, then run it executing the following command from a command prompt:
Testing the Active Directory Monitor
Each time you run the second script the values are uploaded to your Custom Monitor. You can use Windows Task Scheduler to run the script automatically as frequent as you need.
In the script adjust the LDAP connection string to reflect you domain structure and group naming.
You can use the Active Directory properties dialog to determine the distinguished name of the security group or you can use ADSIEdit for this. More information on ADSIEdit here: http://technet.microsoft.com/en-us/library/cc773354%28WS.10%29.aspx
Perform the following steps to add your Custom Monitor widget to your Monitis Dashboard:
From the Monitors menu, select and click Manage Monitors. Select Create Custom Monitor, then click Add to Window.
Refresh the page after adding new data to see them show up inside the widget.
Or you can chose to view your data in chart format
This example of monitoring Active Directory with VBScript shows how easy it is to add a custom monitor and the flexibility of the Monitis Dashboard.
We invite you to check out the testimony of customers who have found recognized the value of cloud-based monitoring with Monitis. One customer, DCmedia Hosting, says Monitis’s “unique interface is easy to use and informative at the same time making setting up monitoring in a browser anywhere a breeze.”
Learn more about Active Directory at our Active Directory Section. Full source code is available at github – https://github.com/monitisexchange/Windows-Monitoring-Scripts/tree/master/vbscript/ActiveDirectory. You can signup Monitis free here.