anchor.diff:  %% ====================================================================
   node_status(Node,CcmStateNum,CcmCStateNum,WorkersOk,Timeout) ->
   	lager:debug("Healthcheck on node:~p",[Node]),
  -	%get state nuber and callback number from node manager and dispatcher
  -	{_, DispCStateNum} = gen_server:call({?Dispatcher_Name, Node}, get_callbacks, Timeout),
  -	DispStateNum = gen_server:call({?Dispatcher_Name, Node}, get_state_num, Timeout),
  -	{ManagerCStateNum,ManagerStateNum} = gen_server:call({?Node_Manager_Name, Node}, get_callback_and_state_num, Timeout),
  -
  -	%compare them with numbers from ccm and prepare result
  -	case (CcmStateNum == DispStateNum) and (CcmCStateNum == DispCStateNum) and (CcmStateNum==ManagerStateNum) and (CcmCStateNum==ManagerCStateNum)  of
  -	true ->
  -		{veil_cluster_node,[{name,atom_to_list(Node)},{status,"ok"}],[]};
  -	false ->
  -		case WorkersOk of
  -			true ->
  -				lager:warning("Healthcheck on node ~p, callbacks/state number of ccm doesn't match values from node_manager and dispatcher," ++
  -					"but all workers are fine, cluster is probably initializing",[Node]),
  -				lager:warning("ccm_state_num: ~p, ccm_callback_num: ~p,disp_state_num: ~p, disp_callback_num: ~p,manager_state_num: ~p, manager_callback_num: ~p",
  -					[CcmStateNum,CcmCStateNum,DispStateNum,DispCStateNum,ManagerStateNum,ManagerCStateNum]),
  -				{veil_cluster_node,[{name,atom_to_list(Node)},{status,"initializing"}],[]};
  -			false ->
  -				lager:error("Healthcheck on node ~p failed, callbacks/state number of ccm doesn't match values from node_manager and dispatcher",[Node]),
  -				lager:error("ccm_state_num: ~p, ccm_callback_num: ~p,disp_state_num: ~p, disp_callback_num: ~p,manager_state_num: ~p, manager_callback_num: ~p",
  -					[CcmStateNum,CcmCStateNum,DispStateNum,DispCStateNum,ManagerStateNum,ManagerCStateNum]),
  -				{veil_cluster_node,[{name,atom_to_list(Node)},{status,"error"}],[]}
  +	try
  +		%get state nuber and callback number from node manager and dispatcher
  +		{_, DispCStateNum} = gen_server:call({?Dispatcher_Name, Node}, get_callbacks, Timeout),
  +		DispStateNum = gen_server:call({?Dispatcher_Name, Node}, get_state_num, Timeout),
  +		{ManagerCStateNum,ManagerStateNum} = gen_server:call({?Node_Manager_Name, Node}, get_callback_and_state_num, Timeout),
  +
  +		%compare them with numbers from ccm and prepare result
  +		AllStateNumbersOk = (CcmStateNum == DispStateNum) and (CcmCStateNum == DispCStateNum) and (CcmStateNum==ManagerStateNum) and (CcmCStateNum==ManagerCStateNum),
  +		case AllStateNumbersOk  of
  +		true ->
  +			{veil_cluster_node,[{name,atom_to_list(Node)},{status,"ok"}],[]};
  +		false ->
  +			case WorkersOk of
  +				true ->
  +					%log
  +					lager:warning("Healthcheck on node ~p, callbacks/state number of ccm doesn't match values from node_manager and dispatcher," ++
  +						"but all workers are fine, cluster is probably initializing",[Node]),
  +					lager:warning("ccm_state_num: ~p, ccm_callback_num: ~p,disp_state_num: ~p, disp_callback_num: ~p,manager_state_num: ~p, manager_callback_num: ~p",
  +						[CcmStateNum,CcmCStateNum,DispStateNum,DispCStateNum,ManagerStateNum,ManagerCStateNum]),
  +					%return
  +					{veil_cluster_node,[{name,atom_to_list(Node)},{status,"initializing"}],[]};
  +				false ->
  +					%log
  +					lager:error("Healthcheck on node ~p failed, callbacks/state number of ccm doesn't match values from node_manager and dispatcher",[Node]),
  +					lager:error("ccm_state_num: ~p, ccm_callback_num: ~p,disp_state_num: ~p, disp_callback_num: ~p,manager_state_num: ~p, manager_callback_num: ~p",
  +						[CcmStateNum,CcmCStateNum,DispStateNum,DispCStateNum,ManagerStateNum,ManagerCStateNum]),
  +					%prepare error
  +					ErrorString1 =
  +						case {(CcmStateNum == DispStateNum),(CcmCStateNum == DispCStateNum),(CcmStateNum==ManagerStateNum),(CcmCStateNum==ManagerCStateNum)} of
  +							{false,_,_,_} -> "{error,invalid_dispatcher_state_num}";
  +							{_,false,_,_} -> "{error,invalid_dispatcher_callback_state_num}";
  +							{_,_,false,_} -> "{error,invalid_manager_state_num}";
  +							{_,_,_,false} -> "{error,invalid_manager_callback_state_num}"
  +						end,
  +					%return
  +					{veil_cluster_node,[{name,atom_to_list(Node)},{status,ErrorString1}],[]}
  +			end
   		end
  +	catch
  +	    Type:Error ->
  +				lager:error("Node ~p connection error: ~p:~p",[Node,Type,Error]),
  +				ErrorString2 = io_lib:format("~p", [{error,Error}]),
  +				{veil_cluster_node,[{name,atom_to_list(Node)},{status,ErrorString2}],[]}
   	end.
   
   %% worker_status/2
  
positive.code: handle(Req, State) ->
  	%get data from ccm and env
  	{ok, Timeout} = application:get_env(veil_cluster_node, nagios_healtcheck_timeout),
  	Nodes = gen_server:call({global, ?CCM}, get_nodes, Timeout),
  	{Workers, StateNum} = gen_server:call({global, ?CCM}, get_workers, Timeout),
  	{_, CStateNum} = gen_server:call({global, ?CCM}, get_callbacks, Timeout),
  
  	%check workers
  	WorkersStatus = pmap(fun(Worker) -> worker_status(Worker,Timeout) end,Workers),
  
negative.code: %% Internal Functions
  %% ====================================================================
  
  %% get_data_from_ccm/1
  %% ====================================================================
  %% @doc Get from ccm: nodes, workers, state number, callbak state number,
  %% error (if error occured, 'none' otherwise)
  %% @end
  -spec get_data_from_ccm(Timeout :: integer()) -> Result when
  	Result :: {Nodes :: list(),Worers :: list(),StateNum :: integer(),CStateNum :: integer(),Error},
  	Error :: term() | none.
  %% ====================================================================
  get_data_from_ccm(Timeout) ->
  	try
  		Nodes = gen_server:call({global, ?CCM}, get_nodes, Timeout),
  		{Workers, StateNum} = gen_server:call({global, ?CCM}, get_workers, Timeout),
  		{_, CStateNum} = gen_server:call({global, ?CCM}, get_callbacks, Timeout),
  		{Nodes,Workers,StateNum,CStateNum,none}
  	catch
  		Type:Error  ->
  			lager:error("Ccm connection error: ~p:~p",[Type,Error]),
  			{[],[],none,none,Error}
  	end.
  
  %% node_status/5
  %% ====================================================================
  %% @doc Checks if callbacks num and state num on dispatcher and node manager are same as in ccm,
  