Custom Script Reports
The create custom script report page allows users to generate reports based on custom scripts within the Motadata AIOps platform. This feature enables organizations to extract specific insights and metrics from their IT environment using customized scripts tailored to their unique monitoring requirements. By leveraging custom script reports, users can gain deeper visibility into key performance indicators, troubleshoot issues, and optimize their infrastructure effectively.
With this feature, organizations can develop and deploy scripts tailored to their specific monitoring needs, allowing them to collect, analyze, and visualize data in a way that aligns with their business objectives.
Select the data to be displayed on the report
To create a custom inventory report, follow the steps below and configure the fields according to your monitoring needs:
| Field | Description |
|---|---|
| Report By | Select the entity for which you want to generate the custom script report from the dropdown menu. |
| Source Filter | Narrow down the scope of the monitors that you want to include in the report by selecting either Monitor, Group, or Tag from the dropdown. This helps you focus on specific subset of monitors based on your selection. |
| Source | Select the specific monitors, groups, or tags to include in the report. Based on the selection made in the previous field, this dropdown will display relevant options to narrow down the source of data for the report. For example, if you selected Monitor in the previous field, the Source dropdown will display a list of all available monitors for you to select from. |
| Result By | Select the criteria for grouping the performance data. Refer Select how the counters are grouped on the widget to understand more about the Result By function. |
| Filters | Use the additional filters to further refine the dataset included in the report. |
| Script Language | Select the Script Language (GO, Python, or Node.js) that you wish you use to create the custom script report. |
By configuring these fields, you can now create a custom script report.
Write the Reporting Script
Compose the Reporting Script according to your desired report format and data retrieval needs.
Below is an example of a Node.js script designed to showcase CPU Utilization metrics for all network devices within your infrastructure:
const readline = require("readline/promises");
const fs = require('node:fs');
const rl = readline.createInterface(process.stdin, process.stdout);
const cmdArgs = process.argv;
let reportContext = cmdArgs[cmdArgs.length - 1].replace(/^(--context=)/, "");
reportContext = JSON.parse(reportContext);
const reportDefination = {
...reportContext,
"visualization.name": "CPU & MEMORY UTILIZATION (Network Device)",
"visualization.timeline": {
"relative.timeline": "today",
"visualization.time.range.inclusive": "no"
},
"visualization.category": "Grid",
"visualization.type": "Grid",
"join.type": "any",
"visualization.data.sources": [
{
"type": "metric",
"join.type": "any",
"visualization.result.by": [
"monitor"
],
"filters": {
"data.filter": {
},
"result.filter": {
}
},
"data.points": [
{
"data.point": "system.cpu.percent",
"aggregator": "avg",
"entities": ["Network"],
"entity.type": "category"
},
{
"data.point": "system.cpu.percent",
"aggregator": "min",
"entities": ["Network"],
"entity.type": "category"
},
{
"data.point": "system.cpu.percent",
"aggregator": "max",
"entities": ["Network"],
"entity.type": "category"
},
{
"data.point": "system.memory.used.percent",
"aggregator": "avg",
"entities": ["Network"],
"entity.type": "category"
},
{
"data.point": "system.memory.used.percent",
"aggregator": "min",
"entities": ["Network"],
"entity.type": "category"
},
{
"data.point": "system.memory.used.percent",
"aggregator": "max",
"entities": ["Network"],
"entity.type": "category"
},
{
"data.point": "ping.latency.ms",
"aggregator": "avg",
"entities": ["Network"],
"entity.type": "category"
}
]
},
{
"type": "availability",
"category": "metric",
"visualization.result.by": [
"monitor"
],
"filters": {
"data.filter": {
}
},
"data.points": [
{
"data.point": "monitor.uptime.percent",
"aggregator": "avg",
"entities": ["Network"],
"entity.type": "category"
}
]
}
],
"visualization.properties": {
"grid": {
"searchable": "yes",
"column.selection": "no",
"header": "yes",
"style": {
"header.font.size": "small"
},
"columns": [
]
}
},
"visualization.result.by": [
],
"granularity": {
"value": 5,
"unit": "m"
},
"join.type": "any",
"join.columns": [
"monitor"
],
"container.type": "dashboard",
"_type": "0",
"id": -1
};
let allData = ''
process.stdin.on("data", (data) => {
allData += data;
if (allData.indexOf("_|@#|_") >= 0) {
const formattedData = JSON.stringify(JSON.parse(allData.toString().replace("_|@#|_", '')))
writeOuput(formattedData)
}
});
function writeOuput(output) {
console.log(output + "_|@#|_");
}
(async function main(widget) {
writeOuput(widget);
})(JSON.stringify(reportDefination));
Click the Execute button to view the report generated using the script in the window below the Reporting Script window in which you wrote the script.
Using the above script, you can generate the following report:

By utilizing custom script reports, you can tailor your reports to suit your specific monitoring requirements and extract valuable insights from your IT environment.