8 Troubleshooting - moudsen/mailGraph GitHub Wiki
In general if something goes wrong (no output), use the following sequence to identify where the error has occured (and raise an issue in this repository so I can take a look at it if you cannot locate the issue by yourself):
- Goto Zabbix => Reports => Action Log and search for events with Status "Failed". Resolve issues related to Zabbix.
- If the popup message says "Syntax Error" something went wrong with the processing during the script. In this case you have to investigate a bit more what is happening.
- Note the eventIdfrom this event for testing the Media Type manually
If the Action Log shows "failed"
The easiest way to test what is happening is to go to Administration => Media types and hit the Test link at the right hand side for MailGraph.
- Replace relevant macros with information and hit TEST (assuming you did configure baseURLandURLbefore):- {EVENT.ID}: zero (or the id located with the above instructions to troubleshoot a specific event). If zero, mailGraph will try to use the last event found in Zabbix problems.
- {ALERT.SENDTO}: mail address
 
- The last line in the result or the log provided at the bottom will tell you what the actual problem is (most likely an access or connectivity issue)
- Fix accordingly and retry until success.
- When fixed verify that any new events are actually sent by email (consider verifying the logdirectory).
Notes
The folllowing logic applies in case {EVENT.ID}=0 or cli_eventId=0
- Try to pick the latest event detected via the Zabbix API
- If no eventId is returned, retry to pick the latest less recent problem via the Zabbix API
- If no eventId is returned, report that there seems to be no list of active problems to pick from and halt
In such case find/set an event ID manually and retry or wait for newly registered events and retry testing mailGraph.
If the Action Log is okay
To facilitate further troubleshooting, you can:
- switch on debug logging (add Zabbix Value debugin the Media type configuration overview with value "1") to receive processing logs as attachment of an e-mail message (note: setting will apply system wide and generate debugging information for all events triggered)
- add a tag debugwith value "1" to any Trigger to receive processing logs as attachment of an e-mail message (specific only to this Trigger)
- switch on $cDebugMailin mailGraph.php to receive processing logs as attachment of an e-mail message (note: applies system wide)
- to review MailGraph stored logs in the /logdirectory when$cDebugis switched on
Testing from the command line (CLI)
In case of an issue that happens before an e-mail is sent, you can also perform a CLI based test:
- php mailGraph.php test
For this to work you need to configure the cli_* settings in config.json!
| Setting | Description | 
|---|---|
| cli_itemId | (Obsolete mailGraph v2.10>) Reference to the actual Zabbix item ID that must be used for testing the code. | 
| cli_eventId | (Mandatory) Reference to the actual Zabbix event ID that must be used for testing the code. Set to zero to have mailGraph pick a random problem (the latest) from Zabbix. | 
| cli_recipient | (Mandatory) Recipient address that will receive this particular test mail. | 
| cli_baseURL | (Mandatory) Reference to the web address where MailGraph is installed. | 
| cli_duration | Fake Zabbix duration (in minutes) of the event. Set to zero or remove if unknown or irrelevant. | 
| cli_subject | To specify the subject of the e-mail message (this may contain TWIG elements). Note that opposite to regular usage in Zabbix, Zabbix macros of values are not evaluated! | 
| cli_period | Must be a valid Zabbix period (like "1d", "1w" or "48h") that will be applied to the graph. Default is "48h" when not specified. | 
| cli_period_header | Is the header displayed above the graph. For example "Last 48 hours". Defaults to 'period' when not specified. | 
| cli_periods | Define multiple periods (max 4) for embedding multiple periods of the same graph in the message (i.e. "10m,4h,1d,7d"). | 
| cli_periods_headers | Headers associated to these periods (i.e. "Last 10 minutes,Last 4 hours,Last day,Last 7 days"). | 
| cli_debug | To attach debug logging to the mail message (0=off,1=on). | 
| cli_proxy | Proxy URL (i.e. 10.20.30.40:8080) that will be used by MailGraph to reach Zabbix. | 
If all fails to resolve the issue ...
Your last resort is to raise an issue in this repository and I will try to assist as soon as possible to fix it!