Sponsored Content
Top Forums Shell Programming and Scripting Failure rate of a node / Data center Post 303020115 by chercheur111 on Friday 13th of July 2018 03:52:05 PM
Old 07-13-2018
Quote:
Originally Posted by Chubler_XL
How about this:

Code:
awk '
{
  for(i= 1; i< NF - 1; i+=3) {
    now=$i
    split($i, tm, ":")
    now=tm[1]*3600+tm[2]*60+tm[3]
    status=$(i+1)
    host=$(i+2)
    if(lastTime[host])
        totalTime[host] += now - lastTime[host]
    lastTime[host]=now
    if(status == "DN") Failure[host]++
    Reading[host]++
  }
}
END {
    for(host in lastTime)
       if (Failure[host])
           if (Failure[host] == Reading[host])
               print host " = 0"
           else
               print host " = " totalTime[host] / Failure[host]
       else
           print host " = No Failures"
}' infile

Infile:
Code:
08:51:36 DN 127.0.0.1 08:51:36 UN 127.0.0.2 08:51:36 UN 127.0.0.3 08:53:50 DN 127.0.0.1 08:53:50 DN 127.0.0.2 08:53:50 UN 127.0.0.3
08:58:36 DN 127.0.0.1 08:58:36 DN 127.0.0.2 08:58:36 UN 127.0.0.2

Result:
Code:
127.0.0.1 = 0
127.0.0.2 = 210
 127.0.0.3 = No Failures


Thank you so much for help.
Kind regards.
 

6 More Discussions You Might Find Interesting

1. Virtualization and Cloud Computing

Cloud Enabling Computing for the Next Generation Data Center

Hear how the changing needs of massive scale-out computing is driving a transfomation in technology and learn how HP is supporting this new evolution of the web. More... (1 Reply)
Discussion started by: Linux Bot
1 Replies

2. HP-UX

Need to set up a HP cluster system in a data center

What are the server requirements, Software requirements, Network requirements etc, Please help me.. as 'm new 'm unable to get things done @ my end alone. Please refrain from typing subjects completely in upper case letters to get more attention, ty. (5 Replies)
Discussion started by: Sounddappan
5 Replies

3. Red Hat

Problem in RedHat Cluster Node while network Failure or in Hang mode

Hi, We are having many RedHat linux Server with Cluster facility for availability of service like HTTPD / MySQL. We face some issue while some issue related to power disturbance / fluctuation or Network failure. There is two Cluster Node configured in... (0 Replies)
Discussion started by: hirenkmistry
0 Replies

4. What is on Your Mind?

Cut Over to New Data Center and Upgraded OS Done. :)

Three days ago we received an expected notice from our long time data center that they were going dark on Sept 12th. About one and a half hours ago, after three days of marathon work, I just cut over the unix.com to a new data center with a completely new OS and Ubuntu distribution. (22 Replies)
Discussion started by: Neo
22 Replies

5. What is on Your Mind?

Resolved: Issue in Server Data Center

Dear All, There was a problem in the data center data, which caused the server to be unreachable for about an hour. Server logs show the server did not crash or go down. Hence, I assume there was a networking issue at the data center. Still waiting for final word on what happened. ... (4 Replies)
Discussion started by: Neo
4 Replies

6. What is on Your Mind?

OUTAGE: Data Center Problem Resolved.

There was a problem with our data center today, creating a site outage (server unreachable). That problem has been resolved. Basically, it seems to have been a socially engineered denial-of-service attack against UNIX.com; which I stopped as soon as I found out what the problem was. Total... (2 Replies)
Discussion started by: Neo
2 Replies
Blt_TreeDeleteNode(3)					      BLT Library Procedures					     Blt_TreeDeleteNode(3)

__________________________________________________________________________________________________________________________________________________

NAME
Blt_TreeDeleteNode - Deletes a node and its descendants. SYNOPSIS
#include <bltTree.h> Blt_TreeNode Blt_TreeDeleteNode(tree, node) ARGUMENTS
Blt_Tree tree (in) Tree containing the node. Blt_TreeNode node (in) Node to be deleted. _________________________________________________________________ DESCRIPTION
This procedure deletes a given node and all it descendants from a tree data object. The arguments are as follows: tree The tree containing the parent node. node Node to be deleted. The node and its descendant nodes are deleted. Each node's data values are deleted also. The reference count of the Tcl_Obj is decremented. Since all tree objects must contain at least a root node, the root node itself can't be deleted unless the tree is released and destroyed. Therefore you can clear a tree by deleting its root, but the root node will remain until the tree is destroyed. RETURNS
Always returns TCL_OK. Errors generated in a notification callbacks are backgrounded (see Tcl_TreeCreateNotifyHandler). EXAMPLE
The following example deletes the root node. Blt_TreeNode root; root = Blt_TreeRootNode(token); Blt_TreeDeleteNode(token, root); NOTIFICATIONS
Blt_TreeDeleteNode can trigger tree notify events. You can be notified whenever a node is deleted by using the Blt_TreeCreateNotifyHan- dler. A callback routine is registered that will be automatically invoked whenever a node is deleted via Blt_TreeDeleteNode to the tree. KEYWORDS
tree, token BLT
2.4 Blt_TreeDeleteNode(3)
All times are GMT -4. The time now is 04:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy