Skip to content

Commit b2b69b8

Browse files
authored
Merge pull request #1 from vasvlad/add_description
Add description
2 parents a0e3a66 + 959f304 commit b2b69b8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ PHP 7, iTop 2.6 и выше (на более ранних версиях iTop р
3838
"ci_key": "Server2 (Grenoble)",
3939
"state": true,
4040
"message": "PROBLEM: host Server2 (Grenoble) unavailable",
41+
"description": "Monitoring: Problem started at 10:35:00 on 2023.11.19<br>Problem name: HTTP service is down on Server2<br>Host: Server2 <br>Severity: Disaster<br>Operational data: Down (0)<br>Original problem ID: 178108686",
4142
"output_fields": "ref,title,status,team_id_friendlyname,agent_id_friendlyname,functionalcis_list"
4243
}
4344
```
@@ -89,7 +90,7 @@ PHP 7, iTop 2.6 и выше (на более ранних версиях iTop р
8990
'org_id' => array('name' => '$ci->org_id->name$'),
9091
'caller_id' => 'SELECT Person WHERE org_id = $ci->org_id$ AND id = 2',
9192
'title' => 'Авария: $alarm->message$',
92-
'description' => 'Авария: $alarm->message$ на КЕ $ci->name$',
93+
'description' => '$alarm->description$',
9394
'service_id' => 2,
9495
),
9596
),
@@ -165,7 +166,7 @@ OQL-запрос для поиска тикета. Найденный тикет
165166
'org_id' => array('name' => '$ci->org_id->name$'),
166167
'caller_id' => 'SELECT Person WHERE org_id = $ci->org_id$ AND id = 2',
167168
'title' => 'Авария: $alarm->message$',
168-
'description' => 'Авария: $alarm->message$ на КЕ $ci->name$',
169+
'description' => '$alarm->description$',
169170
'service_id' => 2,
170171
),
171172
),
@@ -224,6 +225,7 @@ json_data={
224225
"ci_key": "Server4",
225226
"state": 1,
226227
"message": "Server4 is down",
228+
"description": "Server4 is down at 10:35:00 on 2023.11.19",
227229
"output_fields": "title,status,team_id_friendlyname,agent_id_friendlyname,solution"
228230
}
229231
```
@@ -239,6 +241,7 @@ curl -X POST --location "http://localhost:8000/webservices/rest.php?version=1.4"
239241
\"ci_key\": \"Server4\",
240242
\"state\": 1,
241243
\"message\": \"Server4 is down\",
244+
\"description\": \"Server4 is down at 10:35:00 on 2023.11.19\",
242245
\"output_fields\": \"title,status,team_id_friendlyname,agent_id_friendlyname,solution\"
243246
}"
244247
```

main.knowitop-monitoring-api.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function ExecOperation($sVersion, $sVerb, $oParams)
5656
$sCIKey = RestUtils::GetMandatoryParam($oParams, 'ci_key');
5757
$iAlarmState = (int)RestUtils::GetMandatoryParam($oParams, 'state');
5858
$sAlarmMessage = RestUtils::GetMandatoryParam($oParams, 'message');
59+
$sDescription = RestUtils::GetOptionalParam($oParams, 'description', $sAlarmMessage);
5960
// $aAlarmFields = (array)RestUtils::GetOptionalParam($oParams, 'fields', array());
6061

6162
$aContextConfig = utils::GetCurrentModuleSetting($sContextName, array());
@@ -86,6 +87,7 @@ public function ExecOperation($sVersion, $sVerb, $oParams)
8687
'alarm->ci_key' => $sCIKey,
8788
'alarm->state' => $iAlarmState,
8889
'alarm->message' => $sAlarmMessage,
90+
'alarm->description' => $sDescription,
8991
));
9092
// $oMonitoringContext->SetAlarmFields($aAlarmFields);
9193
if (!empty($aContextConfig['ci_oql']))

0 commit comments

Comments
 (0)