7 int main(int argc, char ** argv)
9 EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
10 EVENT_HEADER * heartbeat = NULL;
11 EVENT_FAULT * fault = NULL;
13 printf("\nHello AT&T Vendor Event world!\n");
19 "Usage: %s <FQDN>|<IP address> <port> "
20 "<username> <password>\n", argv[0]);
24 /***************************************************************************/
26 /***************************************************************************/
27 if (evel_initialize(argv[1], /* FQDN */
28 atoi(argv[2]), /* Port */
29 NULL, /* optional path */
30 NULL, /* optional topic */
32 argv[3], /* Username */
33 argv[4], /* Password */
34 EVEL_SOURCE_VIRTUAL_MACHINE, /* Source type */
35 "EVEL training demo", /* Role */
38 fprintf(stderr, "\nFailed to initialize the EVEL library!!!\n");
43 printf("\nInitialization completed\n");
46 /***************************************************************************/
47 /* Send a heartbeat just to show we're alive! */
48 /***************************************************************************/
49 heartbeat = evel_new_heartbeat();
50 if (heartbeat != NULL)
52 evel_rc = evel_post_event(heartbeat);
53 if (evel_rc != EVEL_SUCCESS)
55 printf("Post failed %d (%s)", evel_rc, evel_error_string());
60 printf("New heartbeat failed");
63 /***************************************************************************/
65 /***************************************************************************/
66 fault = evel_new_fault("My alarm condition",
67 "It broke very badly",
71 EVEL_VF_STATUS_PREP_TERMINATE);
74 printf("New fault created...\n");
75 evel_rc = evel_post_event((EVENT_HEADER *)fault);
76 if (evel_rc == EVEL_SUCCESS)
78 printf("Fault posted OK!\n");
82 printf("Post failed %d (%s)\n", evel_rc, evel_error_string());
87 printf("New fault failed (%s)\n", evel_error_string());
90 /***************************************************************************/
92 /***************************************************************************/
95 printf("Terminated\n");