Effective December 3, NetApp adopts Microsoft’s Business-to-Customer (B2C) identity management to simplify and provide secure access to NetApp resources.
For accounts that did not pre-register (prior to Dec 3), access to your NetApp data may take up to 1 hour as your legacy NSS ID is synchronized to the new B2C identity.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Active IQ Unified Manager Discussions

Unified Manager 9.4 and json file creation

Pat_Parent

Hi folks,

 

I need to send a json file when an alert occur. Is there a way of doing the json file automatically ?

if i need to do it with a script, is there a way to send it with a utility....

 

Thank you

 

2 REPLIES 2

GidonMarcus

Hi

 

Assuming your OCUM is Windows based. you can use the PS i published in the following link to consume the parameters:

 

 

 

#create hashtable, Get rid of chars that break the script, append any word that start with " -" to a hashtable index with the input following it until the next " -" as a value.
$parms=@{};" "+($args -replace "\]|\[|@"," " -join " ") -split " -"|?{$_}|%{$t=$_ -split " ",2;$parms.($t[0])=$t[1]}

#run on $parms.eventArgs and append the first word before a "=" as a eventArgs_* index, and as the value any words after it  - until the next word that come before "=".
($parms.eventArgs -split " "|%{if($_ -match "="){".cut."}$_}) -join " " -split ".cut. "|?{$_}|%{$t=$_ -split "=";$parms.("eventArgs_"+$t[0])=$t[1]}  

and use the following command to save it to a json:

 

 

$parms | ConvertTo-Json | Out-File "C:\temp\$($parms.EventID).json"

 

Gidi

 

Gidi Marcus (Linkedin) - Storage and Microsoft technologies consultant - Hydro IT LTD - UK

Pat_Parent

Nope, the appliance so in perl....  

 

#!/usr/bin/perl
#Pour initialiser les variables et assurer un standard
use warnings;
use strict;
use POSIX;
use JSON.pm;

my $Notification = "Yes";
my $Ticket = "Yes";
my $Status = $ARGV[13];
my $Category = $ARGV[5];
my $Time = localtime(time);
my $Timezone = strftime("%Z", localtime());
my $AlertName = $ARGV[3];
my $AlertDesc = $ARGV[15];
my $SysOrigin = $ARGV[9];

my %file_json = ('Need_Notification' => $Notification, 'Need_Ticket'=> $Ticket, 'Status' => $Status, 'Alert_Category' => $Category, 'AlertTime' => $Time, 'AlertTime_TimeZone' => $Timezone, 'Alert_Name' => $AlertName, 'Alert_Description' => $AlertDesc, 'System_Origin' => $SysOrigin);

my $json = encode_json \%file_json;

print $json;

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public