summaryrefslogtreecommitdiff
blob: 0f11f13b814e4f0e1aee7dddddbddcd7518edbd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--- prelude-nagios-0.0.2/src/idmef.c	2003-01-31 03:05:25.000000000 +0800
+++ prelude-nagios-0.0.3/src/idmef.c	2003-06-28 06:00:49.000000000 +0800
@@ -48,7 +48,7 @@
 
 
 
-#define ANALYZER_MODEL "Prelude module for Nagios"
+#define ANALYZER_MODEL "Prelude Nagios"
 #define ANALYZER_CLASS "Network Supervision System"
 #define ANALYZER_MANUFACTURER "ExaProbe http://www.exaprobe.com"
 
@@ -77,6 +77,7 @@
 static idmef_message_t *msg;
 static idmef_alert_t *alert;
 static idmef_target_t *target;
+idmef_classification_t *classification = NULL;
 
 
 /* Misc info to be used in the additional data idmef field*/
@@ -112,7 +113,9 @@
         char *description = NULL;
         int len = 0; 
         const char *host = NULL;
-
+	char classification_message[256];
+	char *final_class_message;
+	
         idmef_alert_assessment_new(alert);
         assessment = alert->assessment;
 
@@ -198,7 +201,16 @@
                         len += sprintf(description+len, "; ");
                 len += sprintf(description+len, "service is %s", target_service_state);
         }
-        
+
+	snprintf(classification_message, sizeof(classification_message), "Host %s%s%s is %s",
+		host,
+		target_service_descr ? " service " : "",
+		target_service_descr ? target_service_descr : "",
+		target_service_state ? target_service_state : target_state);
+
+	final_class_message = strdup(classification_message);
+        idmef_string_set(&classification->name, final_class_message);
+	free( final_class_message );
 
         idmef_string_set(&impact->description, description);
 
@@ -330,7 +342,6 @@
 int idmef_init(void)
 {
         struct timeval tv;
-        idmef_classification_t *classification = NULL;
         idmef_node_t *node = NULL;
 
         msgbuf = prelude_msgbuf_new(0);
@@ -352,7 +363,6 @@
                 return -1;
         }
 
-        idmef_string_set_constant(&classification->name, CLASSIFICATION_NAME);
 
         gettimeofday(&tv, NULL);
         alert->create_time.sec = tv.tv_sec;