2017年1月8日 星期日

Send Splunk Alerts to Line API 試作

Send Splunk Alerts to Line API 試作,參考 URL 如下



在 Line API 介接的程式放置於  $SPLUNK_HOME/bin/scripts


SPLUNK SNMP DATA WITH CACTI MIRAGE 試作 延伸而來.

其它參考資訊:



[root@bbb scripts]# pwd
/opt/splunk/bin/scripts

[root@bbb scripts]# ll
total 12
-rwxr-xr-x 1 root   root   659 Jan  9 14:30 line.pl
-r--r--r-- 1 splunk splunk  71 Oct 26 00:27 readme.txt

[root@bbb scripts]# cat line.pl 
#!/usr/local/bin/perl
use LINE::Bot::API;
use LINE::Bot::API::Builder::SendMessage;
$bot = LINE::Bot::API->new(
channel_secret => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
channel_access_token => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
);

$ToLineUid = "xxxxxxxxxxxxxxxxxxxxxxx";
$messages = LINE::Bot::API::Builder::SendMessage->new;
$messages->add_text( text => " Splunk $ARGV[0] $ARGV[1] $ARGV[2] $ARGV[3] $ARGV[4] $ARGV[5] $ARGV[6] $ARGV[7] $ARGV[8] " );
$bot->push_message($ToLineUid, $messages->build);

[root@bbb scripts]#

























Demo







































































沒有留言:

張貼留言