2020/11/01

 當要在cacti 大量新加設備時

網頁介面操作會花費大量的時間

以下就記錄如何在文字介面下新增設備

要調整graph tree時 再到網頁介面操作


以下新增以網路設備為例


先進到安裝路徑

cd /var/lib/cacti/cli


接下來列出可以使用的 host-templates


php -q add_device.php --list-host-templates

Valid Device Templates: (id, name)

0       None

1       Cacti Stats

2       Cisco Router

3       Generic SNMP Device

4       Local Linux Machine

5       Net-SNMP Device

6       Windows Device


利用下列指令加入 device

php -q add_device.php --avail=snmp --description="192.168.101.254" --ip="192.168.101.254" --template=3 --community="public"


加入完成後列出已加入的 host 及其 id

php -q add_graphs.php --list-hosts

Known Devices: (id, hostname, template, description)

1       localhost       4       Local Linux Machine

4       10.10.254.254   3       10.10.254.254

5       10.0.0.1        3       10.0.0.1

7       192.168.101.254 3       192.168.101.254


列出可以使用的 graph-templates (新版多很多templates)

php -q add_graphs.php --list-graph-templates

Known Graph Templates: (id, name)

1       Cacti Stats - Devices

2       Cacti Stats - Main Poller DS/RRD

3       Cacti Stats - Boost Updates

4       Cacti Stats - Total Poller Items

5       Cacti Stats - Recache (Legacy)

6       Cacti Stats - Processes (Legacy)

7       Cacti Stats - Boost Memory

8       Cacti Stats - User Logins

9       Cacti Stats - User Sessions

10      Cacti Stats - User Types

11      Cacti Stats - Boost Runtime

12      Cacti Stats - Main Poller Runtime

13      Cacti Stats - Export Graphs (Legacy)

14      Cacti Stats - Export Duration (Legacy)

15      Cacti Stats - Syslog Activity

16      Cacti Stats - Syslog Runtime

17      Cacti Stats - Syslog Alerts/Reports

18      Cacti Stats - Thold Runtime

19      Cacti Stats - Boost Average Row Size

20      Cacti Stats - Boost Records

21      Cacti Stats - Boost Table Size

22      Cacti Stats - Boost Timing Detail

23      Cacti Stats - Collector Runtime

24      Cacti Stats - Collector Items

25      Cacti Stats - Collector Settings

26      Cacti Stats - Collector Recache Stats

27      Cacti Stats - WebSeer Timing

28      Cacti Stats - WebSeer Download Size

29      Cacti Stats - WebSeer Download Speed

30      Cacti Stats - WebSeer Status

31      Cacti Stats - Export Graphs

32      Cacti Stats - Export Duration

33      Cisco - CPU Usage

34      Device - Polling Time

35      Device - Uptime

36      Interface - Traffic (bits/sec)

37      Interface - Errors/Discards

38      Interface - Unicast Packets

39      Interface - Non-Unicast Packets

40      Interface - Traffic (bytes/sec)

41      Interface - Traffic (bits/sec, 95th)

42      Interface - Traffic (bits/sec, BW)

43      Interface - Traffic (bytes/sec, BW)

44      Interface - Multicast Packets

45      Interface - Broadcast Packets

46      Unix - Ping Latency

47      SNMP - Generic OID Template

48      Unix - Processes

49      Unix - Load Average

50      Unix - Logged in Users

51      Linux - Memory Usage

52      Unix - Available Disk Space

53      Net-SNMP - Load Average

54      Net-SNMP - Memory Usage

55      Host MIB - Logged in Users

56      Host MIB - Processes

57      Net-SNMP - CPU Utilization

58      Net-SNMP - Interrupts

59      Net-SNMP - Context Switches

60      Net-SNMP - Combined SCSI Disk I/O

61      Net-SNMP - Combined SCSI Disk Bytes

62      Net-SNMP - Available Disk Space

63      Host MIB - Available Disk Space

64      Host MIB - CPU Utilization

65      Net-SNMP - Device I/O - Bytes Read/Written

66      Net-SNMP - Device I/O - Load Averages

67      Net-SNMP - Device I/O - Reads/Writes

=================================================================


列出可以使用的 snmp-queries

php -q add_graphs.php --host-id=2 --list-snmp-queries

Known SNMP Queries: (id, name)

1       Cacti Stats - Data Collector Stats

2       Cacti Stats - WebSeer Service Checks

3       Cacti Stats - Graph Exports

4       SNMP - Interface Statistics

5       Unix - Get Mounted Partitions

6       Net-SNMP -  Get Monitored Partitions

7       SNMP - Get Mounted Partitions

8       SNMP - Get Processor Information

9       Net-SNMP - Get Device I/O

===============================================================


列出snmp queries 可以使用的 query-types

php -q add_graphs.php --snmp-query-id=4 --list-query-types

Known SNMP Query Types: (id, name)

11      In/Out (Errors/Discards)

12      In/Out (Non-Unicast)

13      In/Out (Unicast)

14      In/Out Bytes (64-bit)

15      In/Out Bits

16      In/Out Bits (64-bit)

17      In/Out Bytes

18      In/Out Bits (95th)

19      In/Out Bits (BW)

20      In/Out Bytes (BW)

21      In/Out Bits (64-bit, 95th)

22      In/Out Bits (64-bit, BW)

23      In/Out Bytes (64-bit, BW)

24      In/Out (Broadcasts)

25      In/Out (Multicasts)

===============================================================


利用以上所得的資訊建立圖形


php add_graphs.php --host-id=7 --graph-type=ds --graph-template-id=36 --snmp-query-id=4 --snmp-query-type-id=16 --snmp-field=ifOperStatus --snmp-value=Up

php add_graphs.php --host-id=7 --graph-type=ds --graph-template-id=36 --snmp-query-id=4 --snmp-query-type-id=16 --snmp-field=ifOperStatus --snmp-value=Down


沒有留言: