v2.14 - Fixed missing flag for fetching web url related items

This commit is contained in:
Mark Oudsen 2023-07-15 00:51:55 +02:00
parent 288b0adaf7
commit 97dba8f197
3 changed files with 24 additions and 10 deletions

View File

@ -1,4 +1,4 @@
// mailGraph v2.13 // mailGraph v2.14
try { try {
// Pickup parameters // Pickup parameters
params = JSON.parse(value), params = JSON.parse(value),
@ -16,7 +16,7 @@ try {
// Declare output type // Declare output type
req.addHeader('Content-Type: application/json'); req.addHeader('Content-Type: application/json');
// Must have fields // Pick up fields relevant for mailGraph API level call
fields.itemId = params.itemId * 1; fields.itemId = params.itemId * 1;
fields.eventId = params.eventId * 1; fields.eventId = params.eventId * 1;
fields.recipient = params.recipient; fields.recipient = params.recipient;

View File

@ -57,6 +57,7 @@
// Adding ACK_URL for utilization in the template to point to Ack page // Adding ACK_URL for utilization in the template to point to Ack page
// Small refactor on itemId variable processing (no longer mandatory) // Small refactor on itemId variable processing (no longer mandatory)
// Additional logic added to random eventId to explain in case of issues // Additional logic added to random eventId to explain in case of issues
// Fixed missing flag for fetching web url related items
// ------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------
// //
// (C) M.J.Oudsen, mark.oudsen@puzzl.nl // (C) M.J.Oudsen, mark.oudsen@puzzl.nl
@ -638,6 +639,19 @@
$z_tmp_cookies = $z_path.'tmp/'; $z_tmp_cookies = $z_path.'tmp/';
$z_log_path = $z_path.'log/'; $z_log_path = $z_path.'log/';
// If tmp or log does not exist, create them
if (!is_dir($z_tmp_cookies))
{
mkdir($z_tmp_cookies);
_log('+ created TMP directory "'.$z_tmp_cookies.'"');
}
if (!is_dir($z_log_path))
{
mkdir($z_log_path);
_log('+ created LOG directory "'.$z_log_path.'"');
}
// Zabbix user (requires Super Admin access rights to access image generator script) // Zabbix user (requires Super Admin access rights to access image generator script)
$z_user = $config['zabbix_user']; $z_user = $config['zabbix_user'];
$z_pass = $config['zabbix_user_pwd']; $z_pass = $config['zabbix_user_pwd'];
@ -933,7 +947,8 @@
$request = array('jsonrpc'=>'2.0', $request = array('jsonrpc'=>'2.0',
'method'=>'item.get', 'method'=>'item.get',
'params'=>array('itemids'=>$p_itemId, 'params'=>array('itemids'=>$p_itemId,
'output'=>'extend'), 'webitems'=>'true',
'output'=>'extend'),
'auth'=>$token, 'auth'=>$token,
'id'=>nextRequestID()); 'id'=>nextRequestID());
@ -1407,7 +1422,10 @@
$mailData['LOG_HTML'] = str_replace($cCRLF,'<br/>',$mailData['LOG_HTML']); $mailData['LOG_HTML'] = str_replace($cCRLF,'<br/>',$mailData['LOG_HTML']);
$mailData['LOG_HTML'] = str_replace('<br/>','<br/>'.$cCRLF,$mailData['LOG_HTML']); $mailData['LOG_HTML'] = str_replace('<br/>','<br/>'.$cCRLF,$mailData['LOG_HTML']);
$mailData['LOG_HTML'] = '<html lang="en"><head><meta http-equiv=Content-Type content="text/html; charset=UTF-8">'.$cCRLF. $mailData['LOG_HTML'] = '<html lang="en"><head><meta http-equiv=Content-Type content="text/html; charset=UTF-8"></head>'.$cCRLF.
'<style type="text/css">'.$cCRLF.
'body { font-family: courier, courier new, serif; font-size: 12px; }'.$cCRLF.
'</style>'.$cCRLF.
'<body>'.$cCRLF. '<body>'.$cCRLF.
$mailData['LOG_HTML'].$cCRLF. $mailData['LOG_HTML'].$cCRLF.
'</body>'.$cCRLF. '</body>'.$cCRLF.

View File

@ -35,10 +35,6 @@
<name>infoTest</name> <name>infoTest</name>
<value>Test</value> <value>Test</value>
</parameter> </parameter>
<parameter>
<name>itemId</name>
<value>{ITEM.ID}</value>
</parameter>
<parameter> <parameter>
<name>periods</name> <name>periods</name>
<value>10m,4h,1d,7d</value> <value>10m,4h,1d,7d</value>
@ -64,7 +60,7 @@
<value>https://myzabbix.example.com/mailGraph.php</value> <value>https://myzabbix.example.com/mailGraph.php</value>
</parameter> </parameter>
</parameters> </parameters>
<script>// mailGraph v2.13 <script>// mailGraph v2.14
try { try {
// Pickup parameters // Pickup parameters
params = JSON.parse(value), params = JSON.parse(value),
@ -82,7 +78,7 @@ try {
// Declare output type // Declare output type
req.addHeader('Content-Type: application/json'); req.addHeader('Content-Type: application/json');
// Must have fields // Pick up relevant fields for mailGraph API level call
fields.itemId = params.itemId * 1; fields.itemId = params.itemId * 1;
fields.eventId = params.eventId * 1; fields.eventId = params.eventId * 1;
fields.recipient = params.recipient; fields.recipient = params.recipient;