Subscribe

Neeed to get snapmirror lag more than 24 hours using invoke-nassh command

Hello All,

 

I am using invoke-nassh command and I am interested in fetching only the snapmirror lag above 24 hrs.

 

Note: Will not use get-nasnapmirror command as it doensn't fetch snapmirror details configured from vfiler context

 

commands used: invoke-nassh -name "controller name" -credential "credentials"  "vfiler run * snapmirror status"

 

src:vol1       src2:vol1_sm  snapmirrored   00:20:05

src:vol2       src2:vol2_sm  snapmirrored   24:20:05

Re: Neeed to get snapmirror lag more than 24 hours using invoke-nassh command

'Invoke-NaSsh' sends a Data ONTAP CLI command to the controller via SSH from PSTK. 

PSTK invokes SSH to execute the CLI command on the controller and gets the output as is from the CLI.

So PSTK can not act on formatting the parameters of the output of 'Invoke-NaSsh'.

Re: Neeed to get snapmirror lag more than 24 hours using invoke-nassh command

Agreed. Is there any other way to do this. 

 

Moreover i am facing one more issue, while triggering this script through scheduler it is not pushing the details to the output file but when I run the same script  through Powershell ISE the output file generates the snapmirror status details

 

 

Re: Neeed to get snapmirror lag more than 24 hours using invoke-nassh command

Hello @ARB,

 

You can use the Get-NaSnapmirror cmdlet to get the lag time.  It's stored in the "LagTimeTS" property...

 

(Get-NaSnapmirror $mirrorName).LagTimeTS

For your other issue, how are you outputting the data to a file?  Is other info written to the file?

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: Neeed to get snapmirror lag more than 24 hours using invoke-nassh command

Hello Asulliva,

 

using get-nasnapmirror cmdlet we can get the snapmirror detaila and we can filter with lag time more than 24 hours. But it have some issues.

 

Issue: Get-snapmirror cmdlet doesn't pull the snapmirror relationships which are created from vfiler context. It only pulls the report from vfiler0. Hence any snapmirror which are created from vfiler context are missed. We have tested this functionality.

 

2nd issue: 

 

I am redirecting the output to an outpu file with the below mentioned commands. If I execute the powershell script using Powershell ISE it works and pull the snapmirror data and redirect to the output file as desired but when it runs through windows scheduler it doesn't redirect the output

 

powershell scipt used for the following output:

 

write-ouput "controller name: $controller" | out-file -filepath $out_file -append

write-ouput "====================="  | out-file -filepah $out_file -append

invoke-nassh -name $controller -credentails "$cred"  "vfiler run * snapmirror status" | ft -autosize | out-file $out_file -append

 

NOTE: the above command was also tried using write-output which has also failed to execute the commands

 

Output when run from powershell ise:

 

conroller name: src

===============

src:vol1       src2:vol1_sm  snapmirrored   00:20:05

src:vol2       src2:vol2_sm  snapmirrored   24:20:05

 

 

Output when run from the  windows scheduler

 

conroller name: src

===============

NO OUTPUT OF THE COMMANDS RELATED TO SNAPMIRROR HAS BEEN REDIRECTED TO THE OUT_FILE