Microsoft Virtualization Discussions

Cluster mode powershell uptime reporting

MAXWELL_CROOK
8,703 Views

Hi all

 

I'm in the infancy of powershell, i've managed to write 1 script so far that was pretty basic. However i've recently started down the route of trying to get a basic check in place. The check would be run via a script and would show if the nodes are up.

 

I cannot find a cmdlet of anything in get-ncnode or get-ncnodeinfo that would provide me with this as a starter.

 

Again, I may have missed this due to lack of knowledge but a nudge in the right direction would be greatly appreciated.

 

Thank you !

8 REPLIES 8

markweber
8,571 Views

i'm not sure if you are looking for uptime or if the node is healthy, but they both should be in get-ncnode:

 

PS H:\> (get-ncnode).IsNodeHealthy
True
True

 

PS H:\> (get-ncnode).nodeuptime
2334190
2339855

 

mark

MAXWELL_CROOK
8,547 Views

Both to be honest! So thats really helpful, I keep forgetting that I can do a | fl and get all of the fields. Thanks for taking the time out to answer me. Appreciated.

markweber
8,497 Views

no problem -

 

you can also use get-member to list all the object types/definitions. I use it all the time.

 

PS E:\> get-ncnode |gm


   TypeName: DataONTAP.C.Types.System.NodeDetailsInfo

Name                               MemberType Definition                                                
----                               ---------- ----------                                                
Equals                             Method     bool Equals(System.Object obj)                            
GetHashCode                        Method     int GetHashCode()                                         
GetType                            Method     type GetType()                                            
ToString                           Method     string ToString()                                         
Validate                           Method     void Validate()                                           
CpuBusytime                        Property   System.Object CpuBusytime {get;set;}                      
CpuBusytimeSpecified               Property   bool CpuBusytimeSpecified {get;set;}                      
CpuFirmwareRelease                 Property   System.Object CpuFirmwareRelease {get;set;}               
EnvFailedFanCount                  Property   System.Object EnvFailedFanCount {get;set;}                
EnvFailedFanCountSpecified         Property   bool EnvFailedFanCountSpecified {get;set;}                
EnvFailedFanMessage                Property   System.Object EnvFailedFanMessage {get;set;}              
EnvFailedPowerSupplyCount          Property   System.Object EnvFailedPowerSupplyCount {get;set;}        
EnvFailedPowerSupplyCountSpecified Property   bool EnvFailedPowerSupplyCountSpecified {get;set;}        
EnvFailedPowerSupplyMessage        Property   System.Object EnvFailedPowerSupplyMessage {get;set;}      
EnvOverTemperature                 Property   System.Nullable[bool] EnvOverTemperature {get;set;}       
EnvOverTemperatureSpecified        Property   bool EnvOverTemperatureSpecified {get;set;}               
IsEpsilonNode                      Property   System.Nullable[bool] IsEpsilonNode {get;set;}            
IsEpsilonNodeSpecified             Property   bool IsEpsilonNodeSpecified {get;set;}                    
IsNodeClusterEligible              Property   System.Nullable[bool] IsNodeClusterEligible {get;set;}    
IsNodeClusterEligibleSpecified     Property   bool IsNodeClusterEligibleSpecified {get;set;}            
IsNodeHealthy                      Property   System.Nullable[bool] IsNodeHealthy {get;set;}            
IsNodeHealthySpecified             Property   bool IsNodeHealthySpecified {get;set;}                    
MaximumAggregateSize               Property   System.Object MaximumAggregateSize {get;set;}             
MaximumNumberOfVolumes             Property   System.Object MaximumNumberOfVolumes {get;set;}           
MaximumNumberOfVolumesSpecified    Property   bool MaximumNumberOfVolumesSpecified {get;set;}           
MaximumVolumeSize                  Property   System.Object MaximumVolumeSize {get;set;}                
NcController                       Property   NetApp.Ontapi.Filer.C.NcController NcController {get;set;}
Node                               Property   System.Object Node {get;set;}                             
NodeAssetTag                       Property   System.Object NodeAssetTag {get;set;}                     
NodeLocation                       Property   System.Object NodeLocation {get;set;}                     
NodeModel                          Property   System.Object NodeModel {get;set;}                        
NodeNvramId                        Property   System.Object NodeNvramId {get;set;}                      
NodeNvramIdSpecified               Property   bool NodeNvramIdSpecified {get;set;}                      
NodeOwner                          Property   System.Object NodeOwner {get;set;}                        
NodeSerialNumber                   Property   System.Object NodeSerialNumber {get;set;}                 
NodeSystemId                       Property   System.Object NodeSystemId {get;set;}                     
NodeUptime                         Property   System.Object NodeUptime {get;set;}                       
NodeUptimeSpecified                Property   bool NodeUptimeSpecified {get;set;}                       
NodeUptimeTS                       Property   System.Nullable[timespan] NodeUptimeTS {get;}             
NodeUuid                           Property   System.Object NodeUuid {get;set;}                         
NodeVendor                         Property   System.Object NodeVendor {get;set;}                       
NvramBatteryStatus                 Property   System.Object NvramBatteryStatus {get;set;}               
ProductVersion                     Property   System.Object ProductVersion {get;set;}                   

 

MAXWELL_CROOK
8,460 Views

 

Thats great thank you, let me state what im trying to do as well.

Daily, certain checks are performed manually to ensure that the health of our Netapp estate is running without errors.

 

One of the checks thats perfomed is a

node run -node * -command uptime

 

This gives the following output for all nodes:

 

Node: yournodename

  3:58pm up 26 days,  2:41 162 NFS ops, 98270 CIFS ops, 0 HTTP ops, 11126647187 FCP ops, 0 iSCSI ops

 

What we monitor is the figures above increasing to ensure data is going through each node- we do this as we once had a situation where the nodes where up but no data was being sent or recieved - kind of a big problem! So I want to automate this but i'm really struggling with the powershell equivalent of the above.

 

markweber
8,454 Views

try this:

 

get-ncperfdata -name system -instance system -counter hostname,uptime,nfs_ops,cifs_ops,http_ops,fcp_ops,iscsi_ops

 

you can get a list of all the counters in the system object with:

 

get-ncperfcounter system |select name

 

MAXWELL_CROOK
8,433 Views

I must be doing something wrong as that gives me:

Name Uuid Counters

system uuid counters

system node1-01:kernel:system {cifs_ops, fcp_ops, hostname, http_ops...}

system node1-02:kernel:system {cifs_ops, fcp_ops, hostname, http_ops...}

system node1-03:kernel:system {cifs_ops, fcp_ops, hostname, http_ops...}

system node1-04:kernel:system {cifs_ops, fcp_ops, hostname, http_ops...}

 

 

 

markweber
8,425 Views

no - that's correct.

the actual values are part of the counters property

 

PS E:\> get-ncperfdata -name system -instance system -counter hostname,uptime,nfs_ops,cifs_ops,http_ops,fcp_ops,iscsi_ops

Name                   Uuid                                     Counters                                                                                                                                                                                 
----                   ----                                     --------                                                                                                                                                                                 
system                 LCNA2-01:kernel:system                   {cifs_ops, fcp_ops, hostname, http_ops...}                                                                                                                                               
system                 LCNA2-02:kernel:system                   {cifs_ops, fcp_ops, hostname, http_ops...}                                                                                                                                               
system                 LCNA2-03:kernel:system                   {cifs_ops, fcp_ops, hostname, http_ops...}                                                                                                                                               
system                 LCNA2-04:kernel:system                   {cifs_ops, fcp_ops, hostname, http_ops...}                                                                                                                                               

they can be painful to work with (at least for me) - wrap the above in ( ).counters and you will see the values.

 

you can loop through them and create a custome object to make working with them easier

$data = get-ncperfdata -name system -instance system -counter hostname,uptime,nfs_ops,cifs_ops,http_ops,fcp_ops,iscsi_ops
$results = foreach($datum in $data){
    [PSCustomObject]@{
        "node" = ($datum.counters |where name -eq hostname).value
        "cifs_ops" = ($datum.counters |where name -eq cifs_ops).value
        "fcp_ops" = ($datum.counters |where name -eq fcp_ops).value
        "http_ops" = ($datum.counters |where name -eq http_ops).value
        "iscsi_ops" = ($datum.counters |where name -eq iscsi_ops).value
        "nfs_ops" = ($datum.counters |where name -eq nfs_ops).value
        "uptime" = ($datum.counters |where name -eq uptime).value
        "timestamp" = $datum.timestamp
        "timestampdt" = $datum.timestampdt
    }
}
$results | ft

 which should get you something like this:

PS E:\> $results | ft -AutoSize


node     cifs_ops fcp_ops http_ops iscsi_ops nfs_ops uptime   timestamp timestampdt          
----     -------- ------- -------- --------- ------- ------   --------- -----------          
LCNA2-01 35877    0       0        0         4       2855419 1424883849 2/25/2015 11:04:09 AM
LCNA2-02 48       0       0        0         6       2857639 1424883849 2/25/2015 11:04:09 AM
LCNA2-03 189      0       0        0         0       2854620 1424883849 2/25/2015 11:04:09 AM
LCNA2-04 22       0       0        0         6       2856406 1424883849 2/25/2015 11:04:09 AM

 

MAXWELL_CROOK
8,406 Views

I am genuinely amazed with this, its beyond what I envisaged. Thank you so so much.

 

Certainly gives me a jump start with what i'm trying to achieve. Simply amazing.Smiley Happy

Public