Cacti integration
This topic describes how to integrate a Cacti monitoring source.
Introduction
Cacti is a network traffic monitoring and graphing tool that uses PHP, MySQL, Simple Network Management Protocol (SNMP), and RRDTool. You can easily integrate Cacti with Event Center to centrally manage alerts and events. Follow these steps to integrate your alert records.
How to integrate Cacti monitoring
Step 1: Find the Cacti monitoring source
Log on to Event Center. In the navigation pane on the left, choose . Find the Cacti monitoring source and open the Add Integration page to complete the configuration.
Step 2: Add an alert medium
Prerequisites: The thold plugin is installed and configured. Email alerting is configured.
Modify the {cacti_home}/plugins/thold/thold_functions.php file. In the thold_mail function, add a call to aliyunalert_for_cacti($message,$subject):
function thold_mail($to_email, $from_email, $subject, $message, $filename, $headers = array()) { thold_debug('Preparing to send email'); $subject = trim($subject); $message = str_replace('<SUBJECT>', $subject, $message); aliyunalert_for_cacti($message,$subject); if ($from_email == '') { $from_email = read_config_option('thold_from_email'); $from_name = read_config_option('thold_from_name');After the thold_mail function, add the aliyunalert_for_cacti function. Replace URL in $ch = curl_init("URL") with the following URL:
https://public-alert.aliyuncs.com/event/cacti/{integration_key}NoteThe integration key in the URL corresponds to the Cacti monitoring source.
function aliyunalert_for_cacti($msg, $subject) { $fields = array( "subject" => $subject, "msg" => $msg ); $fieldsdate = json_encode($fields); $ch = curl_init("URL"); curl_setopt($ch, CURLOPT_HEADER, "Content-type: application/json"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsdate); $output = curl_exec($ch); if(curl_errno($ch)){ print curl_error($ch); } curl_close($ch); echo $output; }
Step 3: Confirm the integration
After you complete the configuration, click the Confirm Integration button under the integration key to complete the Cacti integration.
Step 4: Verify that alerts are sent
Check the Cacti logs. A success message for email sending indicates that the alert was sent successfully.
Step 5: Verify the integration
The integration is successful if the status of the Cacti monitoring source is displayed as 'Accepted' on the Integration Configuration page after an alert record is sent from Cacti.