Question: we have ambari cluster with 872 data-nodes machines , when ambari version is 2.6.x

we have for now some network problem , 

after long investigation we found that , ambari agent that runs on some machine not communicate well with the ambari server

therefore we get some strange behaviors as 5 dead data-nodes from ambari dashboard , ***while for sure datanodes machine are healthy*** 

is it possible to give more tolerated value in ambari agent configuration so the ack between ambari agent to ambari server will be after more little time in order to ignore the network problems ?

something like timeout or time connection between the ambari agent to ambari server

Answer: 
Try this.

```
vec2 <- sapply(vec1, function(x) ifelse(x == 2 | x == 3, sample(0:3, 1), 0))

```
This allows you to examine each item in the vector:

```
vec1 <- sample(1:7, 5, replace = TRUE)

my_fn <- function(x) ifelse(x == 2 | x ==3, sample(0:3, 1), 0)

vec2 <- lapply(vec1, my_fn)
unlist(vec2)

```

example answer: 0 0 0 2 3