Check if the hosts is still alive and set it as dead if not.
34{
35 int is_alive = 0;
36 boreas_error_t alive_err;
37
38
39
40 if (prefs_get_bool ("test_alive_hosts_only"))
41 {
42 const gchar *alive_test_str = prefs_get ("ALIVE_TEST");
43
44
45
46 if (!(alive_test_str
47 && atoi (alive_test_str) >= ALIVE_TEST_TCP_ACK_SERVICE
48 && atoi (alive_test_str) < 32
49 && !((atoi (alive_test_str)) & ALIVE_TEST_CONSIDER_ALIVE)))
50 return -1;
51 }
52 else
53 {
54 g_warning ("%s: Trying to perform an alive test, but Boreas is not "
55 "enabled. Heartbeat check for %s will not be performed",
57 return -1;
58 }
59
60 alive_err = is_host_alive (
hostname, &is_alive);
61 if (alive_err)
62 {
63 g_warning ("%s: Heartbeat check failed for %s with error %d.", __func__,
65 return -1;
66 }
67
68 if (is_alive == 0)
69 {
70 g_message ("%s: Heartbeat check was not successful. The host %s has"
71 " been set as dead.",
74 return 0;
75 }
76
77 return 1;
78}
int kb_item_set_int_with_main_kb_check(kb_t kb, const char *name, int value)
Check if the current kb corresponds to the original scanid, if it matches it call kb_item_set_int....