2017年9月21日 星期四
cacti plugin thold + Line API Alert
cacti 0.8.x + setting plugin (0.71)
# vi /var/www/html/cacti/plugins/settings/include/functions.php
function send_mail($to, $from, $subject, $message, $filename = '', $headers = '') {
....
.....
// Line API plugin here
return '';
}
## thold (0.5)
# vi /var/www/html/cacti/plugins/thold/thold_functions.php
function thold_mail($to, $from, $subject, $message, $filename, $headers = '') {
....
.....
// Line API plugin here
return '';
}
======================================================
cacti 1.1.x
# vi /var/www/html/cacti/lib/functions.php
function send_mail($to, $from, $subject, $body, $attachments = '', $headers = '', $html = false) {
....
...
// Line API plugin here
return mailer($from, $to, '', '', '', $subject, $body, '', $attachments, $headers, $html);
}
## thold (1.0.x)
# vi /var/www/html/cacti/plugins/thold/thold_functions.php
function thold_mail($to_email, $from_email, $subject, $message, $filename, $headers = '') {
.......
....
// Line API plugin here
return '';
}
參考資訊
如何做出 cacti plugin manager + Line API Alert
http://xrcd2.blogspot.tw/2017/01/cacti-plugin-manager-line-api-alert.html
使用 Perl 建立 Line API 運用環境
http://xrcd2.blogspot.tw/2016/12/perl-line-api.html
Line API 使用小筆記
http://www.vlab.com.tw/index.php/forum/21/15572-line-api
本 LAB 參考資訊
CACTI Alert 增加 LineNotify
http://penguinbbs.blogspot.tw/2017/08/cacti-alert-linenotify.html
Demo
Demo2
訂閱:
張貼留言 (Atom)
請問您的Demo2是如何取得cacti 1.1的png 檔案
回覆刪除感謝
google cacti graph_image.php
回覆刪除可以詳細解釋一下怎麼用這個嗎
刪除// Line API plugin here
回覆刪除可以提供此Plugin給我參考嗎
所以 plugin 下方處可加上
刪除require ('./vendor/autoload.php');
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '']);
$textMessageBuilder = new \LINE\LINEBot\MessageBuilder\TextMessageBuilder('hello');
$response = $bot->pushMessage('UID', $textMessageBuilder); "
echo $response->getHTTPStatus() . ' ' . $response->getRawBody(); "
===================================
程式開發可參閱
developers.line.me/ or devdocs.line.me/en/
=====================
以 Push Line Message 可參閱
devdocs.line.me/en/#push-message
以 PHP 為例
Push message API example
============
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '']);
$textMessageBuilder = new \LINE\LINEBot\MessageBuilder\TextMessageBuilder('hello');
$response = $bot->pushMessage('UID', $textMessageBuilder); "
echo $response->getHTTPStatus() . ' ' . $response->getRawBody(); "
=================
程式就是這麼簡單.