首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 平面设计 > 图形图像 >

CACTI增多自定义图形

2012-06-29 
CACTI增加自定义图形CACTI中增加新的数据获取方法、数据来源、图像模版以及添加图形到某个监控的主机图像集

CACTI增加自定义图形

CACTI中增加新的数据获取方法、数据来源、图像模版以及添加图形到某个监控的主机图像集里面。

1. Data Input Methods1.1 Data Input Methods[edit: ptt server stat]

? ? Name: ptt server stat

? ? Input Type: Script/Command

? ? Input String: /usr/bin/perl <path_cacti>/scripts/get_ptt_server_status.pl <stub_status_url>

1.2 Input Fields

? ? stub_status_url: 填写Friendly Name

1.3 Output Fields

? ? current_session: 填写Field和Friendly Name

?

2. Data Templates2.1 Data Templates[edit: PTT Server Stat]

? ? Name: PTT Server Stat

2.2 Data Source

? ? Name: |host_description| - PTT Server Stat

? ? Data Input Method: ptt server stat

? ? Associated RRA's: 缺省

? ? Step: 缺省

? ? Data Source Active: 缺省(打勾)

2.3 Data Source Item[current_session]

? ? Internal Data Source Name: current_session

? ? Minimum Value: 0

? ? Maximum Value: 0

? ? Data Source Type: GAUGE

? ? Heartbeat: 600

? ? Output Field: current_session - current_session

2.4 Custom Data[data input: ptt server stat]

? ? Use Per-Data Source Value: addr

? ? 打对勾 Use Per-Data Source Value

?

3. Graph Templates3.1 Graph Template Items[edit: PTT Server Stat]

? ? Graph Item ?Data Source ? ? ? ? ? ? ? ? Graph Item Type ? ? CF Type

? ? Item # 1 ? ?(current_session): Active ? LINE1 ? ? ? ? ? ? ? AVERAGE

? ? Item # 2 ? ?(current_session): Current: GPRINT ? ? ? ? ? ? ?LAST

? ? Item # 3 ? ?(current_session): Average: GPRINT ? ? ? ? ? ? ?AVERAGE

? ? Item # 4 ? ?(current_session): Max: ? ? GPRINT ? ? ? ? ? ? ?MAX

3.2 Graph Item Inputs

? ? Name: Data Source[current_session]

3.3 Template[edit: PTT Server Stat]

? ? Name: PTT Server Stat

3.4 Graph Template

? ? Title: |host_description| - PTT Server Stat

? ? 其它缺省

4 添加图形4.1 Devices->host->Associated Graph Templates增加PTT Server Stat4.2 Create Graphs for this Host4.3 Graph Template Name里面打勾PTT Server Stat

?

5 监控脚本

cat get_ptt_server_status.pl

#!/usr/bin/perluse strict;use Socket;use IO::Socket;if ( exists $ARGV[0]) {    if ( $ARGV[0] =~ /^(.+):(\d+)$/ ) {        my $host = $1;        my $port = $2;        my $n = 0;        my $sock = new IO::Socket::INET(            PeerAddr => $host,            PeerPort => $port,            Proto => 'tcp',            Timeout => 5,            );        $sock->send("RPTR 0\n");        my $pdu = <$sock>;        if ($pdu =~ /(\d+)\n$/) {            $sock->read($pdu, $1);            if ($pdu =~ /^SESSIONS: (\d+)/) {                $n = $1;            }        }        close($sock);        print "current_session:$n ";        print "\n";    }}
?

热点排行