2017年6月22日 星期四

使用 netdata 監控 SNMP 設備試作


使用 netdata 監控 SNMP 設備試作

在 netdata 試裝 ( http://xrcd2.blogspot.tw/2017/06/netdata_21.html ) 後
,接著試透過 netdata 來做一般的 snmp monitor ,
其實大多數的網管軟體都提供這樣的基本功能,但以 netdata 來說,
還是需要一些 snmp 的基礎觀念.故整理一下之前所寫的一些基礎,
供需求的人參考之.


SNMP 基礎


(1) http://xrcd2.blogspot.tw/2012/10/snmp-oids-zabbix.html
     [ 利用SNMP OIDs 加入 Zabbix 監控 ]
(2) http://xrcd2.blogspot.tw/2012/10/snmp-oid.html
     [ 再論 SNMP OIDs ]
(3) http://xrcd2.blogspot.tw/2016/11/snmp-oids.html
     [ 三論 SNMP OIDs ]
(4) http://xrcd2.blogspot.tw/2017/04/snmp-oids.html
     [ 四論 SNMP OIDs ]

其它補充

(2) http://xrcd2.blogspot.tw/2012/11/cisco-router-interface-reliability.html
[ Cisco Router Interface Reliability Status Monitor ( DIY cacti template ) ]


本文開始

參考設定

https://github.com/firehol/netdata/blob/master/conf.d/node.d/snmp.conf.md

SNMP Data Collector


example:

{
    "enable_autodetect": false,
    "update_every": 5,
    "max_request_size": 100,
    "servers": [
        {
            "hostname": "10.11.12.8",
            "community": "public",
            "update_every": 10,
            "max_request_size": 50,
            "options": { "timeout": 10000 },
            "charts": {
                "snmp_switch.bandwidth_port1": {
                    "title": "Switch Bandwidth for port 1",
                    "units": "kilobits/s",
                    "type": "area",
                    "priority": 1,
                    "family": "ports",
                    "dimensions": {
                        "in": {
                            "oid": "1.3.6.1.2.1.2.2.1.10.1",
                            "algorithm": "incremental",
                            "multiplier": 8,
                            "divisor": 1024,
                            "offset": 0
                        },
                        "out": {
                            "oid": "1.3.6.1.2.1.2.2.1.16.1",
                            "algorithm": "incremental",
                            "multiplier": -8,
                            "divisor": 1024,
                            "offset": 0
                        }
                    }
                },
                "snmp_switch.bandwidth_port2": {
                    "title": "Switch Bandwidth for port 2",
                    "units": "kilobits/s",
                    "type": "area",
                    "priority": 1,
                    "family": "ports",
                    "dimensions": {
                        "in": {
                            "oid": "1.3.6.1.2.1.2.2.1.10.2",
                            "algorithm": "incremental",
                            "multiplier": 8,
                            "divisor": 1024,
                            "offset": 0
                        },
                        "out": {
                            "oid": "1.3.6.1.2.1.2.2.1.16.2",
                            "algorithm": "incremental",
                            "multiplier": -8,
                            "divisor": 1024,
                            "offset": 0
                        }
                    }
                }
            }
        }
    ]
}



依據上述的範例,得知 netdata snmp data collector 的方式為 OIDs ,
以 Interface Traffic 來說,可以用 1.3.6.1.2.1.2.2.1.10.ifName ( Inbound )
用 1.3.6.1.2.1.2.2.1.10.ifName (Outgoing )取得流量使用資訊.

這時可以使用  snmpwalk +  snmpget 來確定如何設定正確的 snmp.conf

以 Cisco 2960S Switch 為例



[root@centos73 ~]#  snmpwalk -Os -c cisco -v 2c 192.168.111.198  system | more
sysDescr.0 = STRING: Cisco IOS Software, C2960S Software (C2960S-UNIVERSALK9-M),
Version 15.2(1)E, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Tue 27-Aug-13 11:59 by prod_rel_team
sysObjectID.0 = OID: enterprises.9.1.1208
sysUpTimeInstance = Timeticks: (758822632) 87 days, 19:50:26.32
sysContact.0 = STRING:
sysName.0 = STRING: Switch
sysLocation.0 = STRING:
sysServices.0 = INTEGER: 6
sysORLastChange.0 = Timeticks: (0) 0:00:00.00
sysORID.1 = OID: enterprises.9.7.129
sysORID.2 = OID: enterprises.9.7.115

.....
.....
.....
.....


[root@centos73 ~]#  snmpwalk -Os -c cisco  -v 2c 192.168.111.198  1.3.6.1.2.1.31.1.1.1.1
ifName.1 = STRING: Vl1
ifName.5137 = STRING: StackPort1
ifName.10101 = STRING: Gi1/0/1
ifName.10102 = STRING: Gi1/0/2
ifName.10103 = STRING: Gi1/0/3
ifName.10104 = STRING: Gi1/0/4
ifName.10105 = STRING: Gi1/0/5
ifName.10106 = STRING: Gi1/0/6
ifName.10107 = STRING: Gi1/0/7
ifName.10108 = STRING: Gi1/0/8
ifName.10109 = STRING: Gi1/0/9
ifName.10110 = STRING: Gi1/0/10
ifName.10111 = STRING: Gi1/0/11
ifName.10112 = STRING: Gi1/0/12
ifName.10113 = STRING: Gi1/0/13
ifName.10114 = STRING: Gi1/0/14
ifName.10115 = STRING: Gi1/0/15
ifName.10116 = STRING: Gi1/0/16
ifName.10117 = STRING: Gi1/0/17
ifName.10118 = STRING: Gi1/0/18
ifName.10119 = STRING: Gi1/0/19
ifName.10120 = STRING: Gi1/0/20
ifName.10121 = STRING: Gi1/0/21
ifName.10122 = STRING: Gi1/0/22
ifName.10123 = STRING: Gi1/0/23
ifName.10124 = STRING: Gi1/0/24
ifName.10125 = STRING: Gi1/0/25
ifName.10126 = STRING: Gi1/0/26
ifName.10127 = STRING: Gi1/0/27
ifName.10128 = STRING: Gi1/0/28
ifName.10129 = STRING: Gi1/0/29
ifName.10130 = STRING: Gi1/0/30
ifName.10131 = STRING: Gi1/0/31
ifName.10132 = STRING: Gi1/0/32
ifName.10133 = STRING: Gi1/0/33
ifName.10134 = STRING: Gi1/0/34
ifName.10135 = STRING: Gi1/0/35
ifName.10136 = STRING: Gi1/0/36
ifName.10137 = STRING: Gi1/0/37
ifName.10138 = STRING: Gi1/0/38
ifName.10139 = STRING: Gi1/0/39
ifName.10140 = STRING: Gi1/0/40
ifName.10141 = STRING: Gi1/0/41
ifName.10142 = STRING: Gi1/0/42
ifName.10143 = STRING: Gi1/0/43
ifName.10144 = STRING: Gi1/0/44
ifName.10145 = STRING: Gi1/0/45
ifName.10146 = STRING: Gi1/0/46
ifName.10147 = STRING: Gi1/0/47
ifName.10148 = STRING: Gi1/0/48
ifName.10149 = STRING: Gi1/0/49
ifName.10150 = STRING: Gi1/0/50
ifName.10151 = STRING: Gi1/0/51
ifName.10152 = STRING: Gi1/0/52
ifName.12001 = STRING: Nu0
ifName.12002 = STRING: Fa0
[root@centos73 ~]#

取得該 Switch Port  Gi1/0/11 的流量資訊 (ifName.10111 = STRING: Gi1/0/11)

In

[root@centos73 ~]# snmpget -v2c -c cisco 192.168.111.198  1.3.6.1.2.1.2.2.1.10.10111
IF-MIB::ifInOctets.10111 = Counter32: 2637654576

Out

[root@centos73 ~]# snmpget -v2c -c cisco 192.168.111.198  1.3.6.1.2.1.2.2.1.16.10111
IF-MIB::ifOutOctets.10111 = Counter32: 1963738193
[root@centos73 ~]#



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


[root@centos73 node.d]# pwd
/etc/netdata/node.d


抄改上面的  example:


[root@centos73 node.d]# vi   snmp.conf  [圖一]
{
    "enable_autodetect": false,
    "update_every": 5,
    "max_request_size": 100,
    "servers": [
        {
            "hostname": "192.168.111.198",
            "community": "cisco",
            "update_every": 10,
            "max_request_size": 50,
            "options": { "timeout": 10000 , "version": 1 },
            "charts": {
                "snmp_switch.bandwidth_port1": {
                    "title": "Switch Bandwidth for port 1",
                    "units": "kilobits/s",
                    "type": "area",
                    "priority": 1,
                    "family": "ports",
                    "dimensions": {
                        "in": {
                            "oid": "1.3.6.1.2.1.2.2.1.10.10101",
                            "algorithm": "incremental",
                            "multiplier": 8,
                            "divisor": 1024,
                            "offset": 0
                        },
                        "out": {
                            "oid": "1.3.6.1.2.1.2.2.1.16.10101",
                            "algorithm": "incremental",
                            "multiplier": -8,
                            "divisor": 1024,
                            "offset": 0
                        }
                    }
                },
                "snmp_switch.bandwidth_port11": {
                    "title": "Switch Bandwidth for port 11",
                    "units": "kilobits/s",
                    "type": "area",
                    "priority": 1,
                    "family": "ports",
                    "dimensions": {
                        "in": {
                            "oid": "1.3.6.1.2.1.2.2.1.10.10111",
                            "algorithm": "incremental",
                            "multiplier": 8,
                            "divisor": 1024,
                            "offset": 0
                        },
                        "out": {
                            "oid": "1.3.6.1.2.1.2.2.1.16.10111",
                            "algorithm": "incremental",
                            "multiplier": -8,
                            "divisor": 1024,
                            "offset": 0
                        }
                    }
                }
            }
        }
    ]
}



========

修改自另一個範例 multiply_range


[root@centos73 node.d]# cat snmp.conf [圖二]
{
    "enable_autodetect": false,
    "update_every": 60,
    "servers": [
        {
            "hostname": "192.168.111.198",
            "community": "cisco",
            "update_every": 60,
            "options": { "timeout": 20000, "version": 1 },
            "charts": {
                "snmp_switch.bandwidth_port": {
                    "title": "Switch Bandwidth for port ",
                    "units": "kilobits/s",
                    "type": "area",
                    "priority": 1,
                    "family": "ports",
                    "multiply_range": [ 10101, 10152 ],
                    "dimensions": {
                        "in": {
                            "oid": "1.3.6.1.2.1.2.2.1.10.",
                            "algorithm": "incremental",
                            "multiplier": 8,
                            "divisor": 1024,
                            "offset": 0
                        },
                        "out": {
                            "oid": "1.3.6.1.2.1.2.2.1.16.",
                            "algorithm": "incremental",
                            "multiplier": -8,
                            "divisor": 1024,
                            "offset": 0
                        }
                    }
                }
            }
        }
    ]
}

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

驗證 snmp plugin

( 可參考 https://github.com/firehol/netdata/blob/master/conf.d/node.d/snmp.conf.md
 [ Testing the configuration ] 這一段的方式 )

[root@centos73 node.d]# /usr/libexec/netdata/plugins.d/node.d.plugin 1 snmp
/usr/libexec/netdata/plugins.d/node.d.plugin: line 2: exec: ERROR node.js IS NOT AVAILABLE IN THIS SYSTEM: not found


出現上述這訊息即為,未安裝 nodejs 套件

解法

#yum install epel-release
#yum install nodejs

驗證 nodejs

[root@centos73 node.d]# node --version
v6.10.3


裝好後再測試一次

[root@centos73 node.d]# /usr/libexec/netdata/plugins.d/node.d.plugin 1 snmp
2017-06-22 11:07:00: node.d.plugin: ERROR: snmp: 192.168.111.198: Received error = TypeError: snmp.varbindError is not a function
    at Object.responseCb (/usr/libexec/netdata/node.d/snmp.node.js:267:89)
    at Object.feedCb (/usr/libexec/netdata/node.d/node_modules/net-snmp.js:646:8)
    at Object.Session.onSimpleGetResponse [as onResponse] (/usr/libexec/netdata/node.d/node_modules/net-snmp.js:960:7)
    at Session.onMsg (/usr/libexec/netdata/node.d/node_modules/net-snmp.js:929:9)
    at emitTwo (events.js:106:13)
    at Socket.emit (events.js:191:7)
    at UDP.onMessage (dgram.js:549:8) varbinds = undefined
DISABLE

出現上述訊息則為 snmp.conf 設定錯誤,請利用 snmpwalk +  snmpget 來確認 snmp 相關資訊的配置.


過關無誤則會出現以下資訊

[root@centos73 node.d]# /usr/libexec/netdata/plugins.d/node.d.plugin 1 snmp
CHART "snmp_switch.bandwidth_port1" "snmp_switch.bandwidth_port1" "Switch Bandwidth for port 1" "kilobits/s" "ports" "" "area" 50001 10
DIMENSION "in" "in" "incremental" 8 1024
DIMENSION "out" "out" "incremental" -8 1024
BEGIN snmp_switch.bandwidth_port1
SET in = 1167620306
SET out = 220094275
END

CHART "snmp_switch.bandwidth_port11" "snmp_switch.bandwidth_port11" "Switch Bandwidth for port 11" "kilobits/s" "ports" "" "area" 50001 10
DIMENSION "in" "in" "incremental" 8 1024
DIMENSION "out" "out" "incremental" -8 1024
BEGIN snmp_switch.bandwidth_port11
SET in = 2509704807
SET out = 1913107763
END

BEGIN snmp_switch.bandwidth_port1 3548000
SET in = 1167620306
SET out = 220107600
END

BEGIN snmp_switch.bandwidth_port11 3548000
SET in = 2509816273
SET out = 1913162904
END

BEGIN snmp_switch.bandwidth_port1 10040000
SET in = 1167620306
SET out = 220133355
END

BEGIN snmp_switch.bandwidth_port11 10040000
SET in = 2510106481
SET out = 1913238854
END
.....

新增圖示可參考如下 URL

https://github.com/firehol/netdata/wiki/Add-more-charts-to-netdata#network

Add more charts to netdata

configuring plugins

Most plugins come with auto-detection, configured to work out-of-the-box on popular
operating systems with the default settings.

However, there are cases that auto-detection fails. Usually the reason is that the
applications to be monitored do not allow netdata to connect. In most of the cases,
allowing the user netdata from localhost to connect and collect metrics, will
automatically enable data collection for the application in question
(it will require a netdata restart).

You can verify netdata plugins are able to collect metrics, following this procedure:

# become user netdata
sudo su -s /bin/bash netdata

# execute the plugin in debug mode, for a specific module.
# example for the python plugin, mysql module:
/usr/libexec/netdata/plugins.d/python.d.plugin 1 debug mysql

其它參考資訊

General Info node.d

https://github.com/firehol/netdata/wiki/General-Info---node.d


Demo

2 interface [圖一]




All Interface [圖二]



2017年6月21日 星期三

netdata 試裝

今天在網上亂逛,剛好看到一個 netdata 的軟體,
網上是說~它是可以用來即時監控 Linux 的網管軟體,
而且安裝很簡單,就順手裝來玩看看.

安裝的 SOP 如下:  OS 以 CentOS 7 為例 (netdata  release 1.6.0)

#yum install -y zlib-devel gcc make git autoconf autogen automake pkgconfig libuuid libuuid-devel

#git clone https://github.com/firehol/netdata.git

#cd netdata

#./netdata-installer.sh

如缺相依軟體則會顯示
....

Sorry! netdata failed to build...

You many need to check these:

1. The package uuid-dev (or libuuid-devel) has to be installed.

   If your system cannot find libuuid, although it is installed
   run me with the option:  --libs-are-really-here

2. The package zlib1g-dev (or zlib-devel) has to be installed.

   If your system cannot find zlib, although it is installed
   run me with the option:  --libs-are-really-here

3. You need basic build tools installed, like:

   gcc make autoconf automake pkg-config

   Autoconf version 2.60 or higher is required.

If you still cannot get it to build, ask for help at github:

   https://github.com/firehol/netdata/issues

如安裝完成則會顯示:
....

Downloading default configuration from netdata...
New configuration saved for you to edit at /etc/netdata/netdata.conf
 --- Check KSM (kernel memory deduper) ---

Memory de-duplication instructions

You have kernel memory de-duper (called Kernel Same-page Merging,
or KSM) available, but it is not currently enabled.

To enable it run:

    echo 1 >/sys/kernel/mm/ksm/run
    echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs

If you enable it, you will save 40-60% of netdata memory.

 --- Check version.txt ---
 --- Check apps.plugin ---
 --- Generate netdata-uninstaller.sh ---
 --- Basic netdata instructions ---

netdata by default listens on all IPs on port 19999,
so you can access it with:

  http://this.machine.ip:19999/

To stop netdata run:

  systemctl stop netdata

To start netdata run:

  systemctl start netdata


Uninstall script generated: ./netdata-uninstaller.sh
Update script generated   : ./netdata-updater.sh

netdata-updater.sh can work from cron. It will trigger an email from cron
only if it fails (it does not print anything when it can update netdata).
Run this to automatically check and install netdata updates once per day:

sudo ln -s /usr/local/src/netdata/netdata/netdata-updater.sh /etc/cron.daily/netdata-updater

 --- We are done! ---

  ^
  |.-.   .-.   .-.   .-.   .-.   .  netdata                          .-.   .-
  |   '-'   '-'   '-'   '-'   '-'   is installed and running now!  -'   '-'
  +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->

  enjoy real-time performance and health monitoring...

..

那就可以直接連入該主機的  monitor  web 了,
如果安裝多台亦可以在同一個 Browser 去點選不同的主機.








關於 netdata

https://github.com/firehol/netdata


Demo

http://my-netdata.io/#demosites



其它的 Demo Sites URL 寫在 ( https://github.com/firehol/netdata/wiki )

http://london.my-netdata.io/
http://atlanta.my-netdata.io/
http://bangalore.my-netdata.io/
http://sanfrancisco.my-netdata.io
.....


https://my-netdata.io

★ Scalable
netdata scales out, your web browser is the central netdata connecting all your servers together.
But netdata can also replicate its database to other netdata, and archive its metrics to graphite,
 opentsdb, influxdb or prometheus at a lower rate, to avoid congesting these servers with the
amount of data collected.


https://github.com/firehol/netdata/wiki/netdata-backends





所以 dashboard 就有多種的變化可能....

如 grafana  + netdata ( https://grafana.com/dashboards/1295 ).....

2017年4月20日 星期四

四論 SNMP OIDs

基礎入門

(1)利用SNMP OIDs 加入 Zabbix 監控
http://xrcd2.blogspot.tw/2012/10/snmp-oids-zabbix.html

(2)再論 SNMP OIDs
http://xrcd2.blogspot.tw/2012/10/snmp-oid.html

(3)三論 SNMP OIDs
http://xrcd2.blogspot.tw/2016/11/snmp-oids.html

(4)四論 SNMP OIDs


本文開始


縁起於 http://www.netadmin.com.tw/article_content.aspx?sn=1702080002
網管人-技術專欄
2017/2/15
透過SNMP Query Index協助管理 資源流量圖表自動產出
Cacti監控報表圖多不愁 批次抓取設備資料繪製
丁光立

因為想多學一點 Cacti 的技巧,所以參考了上述文章,一些觀念,寫成這個小筆記供需要
的人參考,但本文會著重於 Linux (CentOS) 的 snmp 實用指令簡介及運用與
 snmp.conf 的撰寫參考等等.建議在閱讀本文之前,可看參考上述基本門,強化
 snmp 基本觀念.


(1) linux (  CentOS ) snmpd.conf
詳細設定可參考
http://net-snmp.sourceforge.net/docs/man/snmpd.conf.html

為方便使用可參考如下設定,請抄改成個人的使用環境配置.

[root@bbb /]# cat /etc/snmp/snmpd.conf

rocommunity public

#這一行是宣告 MIB 檔的目錄.
#MIBDIRS /usr/share/snmp/mibs:/usr/share/snmp/private-mibs
#這一行是宣告載入所有的 MIB 檔
#MIBS all

#宣告使用 CHECK-R77-MIB及CISCO-QOS-PIB-MIB
mibs +CHECK-R77-MIB:CISCO-QOS-PIB-MIB
#宣告使用 CISCO-MEMORY-POOL-MIB
mibs +CISCO-MEMORY-POOL-MIB

#另一種宣告方式

mibfile /usr/share/snmp/mibs/CHECK-R77-MIB.txt

#其它資訊

sysLocation vlab
sysContact wwww.vlab.com.tw
sysName Cacti

# 其它參考資訊如下 URL
# http://www.net-snmp.org/FAQ.html#How_do_I_add_a_MIB_
# 系統預設的 mibs 的目錄為 /usr/share/snmp/mibs 可將自行下載的 mib 檔放置於此目錄內.


測試一下 本機 liunx 的系統資訊

[root@bbb /]# snmpwalk -v2c -c public localhost system
SNMPv2-MIB::sysDescr.0 = STRING: Linux www.vlab.com.tw 2.6.32-642.11.1.el6.x86_64 #1 SMP Fri Nov 18 19:25:05 UTC 2016 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (11265) 0:01:52.65
SNMPv2-MIB::sysContact.0 = STRING: wwww.vlab.com.tw
SNMPv2-MIB::sysName.0 = STRING: Cacti
SNMPv2-MIB::sysLocation.0 = STRING: vlab
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.8 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.3 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.7 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.8 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (3) 0:00:00.03
[root@bbb /]#


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

Cisco 設備啟用 snmp 服務


Router#sh run 
.....
.....
!
!
snmp-server community public RO
!
!
....
.....

Router#sh ver 
Cisco IOS XE Software, Version 03.10.02.S - Extended Support Release
Cisco IOS Software, CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 15.3(3)S2, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2014 by Cisco Systems, Inc.
Compiled Fri 31-Jan-14 20:10 by mcpre
.....


Router#show memory 
                Head    Total(b)     Used(b)     Free(b)   Lowest(b)  Largest(b)
Processor  7F4216AD6010   2232382384   195274364   2037108020   2036934440   1332474908
 lsmpi_io  7F41C34CE1A8     6295128     6294304         824         824         412


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


測試一下 Cisco 設備的系統資訊

[root@bbb /]# snmpwalk -v2c -c public 192.168.111.158 system
SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software, CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 15.3(3)S2, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2014 by Cisco Systems, Inc.
Compiled Fri 31-Jan-14 20:10 by mcpre
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.9.1.1537
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (10206994) 1 day, 4:21:09.94
SNMPv2-MIB::sysContact.0 = STRING: 
SNMPv2-MIB::sysName.0 = STRING: Router
SNMPv2-MIB::sysLocation.0 = STRING: 
SNMPv2-MIB::sysServices.0 = INTEGER: 78
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00



(2)使用 export MIBS , 以 CISCO-MEMORY-POOL-MIB 為例


[root@bbb /]# MIBS=+CISCO-MEMORY-POOL-MIB
[root@bbb /]# export MIBS


[root@bbb /]#   snmpwalk -c public -v2c     192.168.111.158   .1.3.6.1.4.1.9.9.48
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.1 = STRING: Processor
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.14 = STRING: lsmpi_io
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolAlternate.1 = INTEGER: 0
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolAlternate.14 = INTEGER: 0
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolValid.1 = INTEGER: true(1)
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolValid.14 = INTEGER: true(1)
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.1 = Gauge32: 195206240 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.14 = Gauge32: 6294296 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.1 = Gauge32: 2037176144 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.14 = Gauge32: 832 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolLargestFree.1 = Gauge32: 1332474908 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolLargestFree.14 = Gauge32: 412 bytes


(3) 未使用 CISCO-MEMORY-POOL-MIB


[root@bbb /]#  snmpwalk -c public -v2c     192.168.111.158   .1.3.6.1.4.1.9.9.48
SNMPv2-SMI::enterprises.9.9.48.1.1.1.2.1 = STRING: "Processor"
SNMPv2-SMI::enterprises.9.9.48.1.1.1.2.14 = STRING: "lsmpi_io"
SNMPv2-SMI::enterprises.9.9.48.1.1.1.3.1 = INTEGER: 0
SNMPv2-SMI::enterprises.9.9.48.1.1.1.3.14 = INTEGER: 0
SNMPv2-SMI::enterprises.9.9.48.1.1.1.4.1 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.48.1.1.1.4.14 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.48.1.1.1.5.1 = Gauge32: 195206240
SNMPv2-SMI::enterprises.9.9.48.1.1.1.5.14 = Gauge32: 6294296
SNMPv2-SMI::enterprises.9.9.48.1.1.1.6.1 = Gauge32: 2037176144
SNMPv2-SMI::enterprises.9.9.48.1.1.1.6.14 = Gauge32: 832
SNMPv2-SMI::enterprises.9.9.48.1.1.1.7.1 = Gauge32: 1332474908
SNMPv2-SMI::enterprises.9.9.48.1.1.1.7.14 = Gauge32: 412

一般而言,有導入使用 MIB 檔會比較方便閱讀與理解.


(4)透過 load mib 參數



[root@bbb/]# snmpwalk -c public -v2c 192.168.111.158 CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolMIB
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.1 = STRING: Processor
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.14 = STRING: lsmpi_io
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolAlternate.1 = INTEGER: 0
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolAlternate.14 = INTEGER: 0
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolValid.1 = INTEGER: true(1)
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolValid.14 = INTEGER: true(1)
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.1 = Gauge32: 195216024 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.14 = Gauge32: 6294296 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.1 = Gauge32: 2037166360 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.14 = Gauge32: 832 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolLargestFree.1 = Gauge32: 1332474908 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolLargestFree.14 = Gauge32: 412 bytes


或

[root@bbb /]# snmpwalk -c public -v2c  -m CISCO-MEMORY-POOL-MIB   192.168.111.158   .1.3.6.1.4.1.9.9.48
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.1 = STRING: Processor
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.14 = STRING: lsmpi_io
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolAlternate.1 = INTEGER: 0
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolAlternate.14 = INTEGER: 0
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolValid.1 = INTEGER: true(1)
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolValid.14 = INTEGER: true(1)
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.1 = Gauge32: 195216016 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.14 = Gauge32: 6294296 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.1 = Gauge32: 2037166368 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.14 = Gauge32: 832 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolLargestFree.1 = Gauge32: 1332474908 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolLargestFree.14 = Gauge32: 412 bytes


(5) OIDs 表示法

[root@bbb /]#  snmpwalk -c public -v2c  192.168.111.158 .iso.org.dod.internet.private.enterprises.cisco.ciscoMgmt.ciscoMemoryPoolMIB

CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.1 = STRING:  Processor
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.14 = STRING: lsmpi_io
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolAlternate.1 = INTEGER: 0
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolAlternate.14 = INTEGER: 0
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolValid.1 = INTEGER: true(1)
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolValid.14 = INTEGER: true(1)
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.1 = Gauge32: 195210248 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.14 = Gauge32: 6294296 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.1 = Gauge32: 2037172136 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.14 = Gauge32: 832 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolLargestFree.1 = Gauge32: 1332474908 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolLargestFree.14 = Gauge32: 412 bytes
[root@bbb /]#

如未載入  CISCO-MEMORY-POOL-MIB

[root@bbb /]# snmpwalk -c public -v2c  192.168.111.158 .iso.org.dod.internet.private.enterprises.cisco.ciscoMgmt.ciscoMemoryPoolMIB

No log handling enabled - turning on stderr logging
.iso.org.dod.internet.private.enterprises.cisco.ciscoMgmt.ciscoMemoryPoolMIB: Unknown Object Identifier (Sub-id not found: enterprises -> cisco)

[root@bbb /]#

改用數字

[root@bbb /]#  snmpwalk -c public -v2c     192.168.111.158   .1.3.6.1.4.1.9.9.48
SNMPv2-SMI::enterprises.9.9.48.1.1.1.2.1 = STRING: "Processor"
SNMPv2-SMI::enterprises.9.9.48.1.1.1.2.14 = STRING: "lsmpi_io "
SNMPv2-SMI::enterprises.9.9.48.1.1.1.3.1 = INTEGER: 0
SNMPv2-SMI::enterprises.9.9.48.1.1.1.3.14 = INTEGER: 0
SNMPv2-SMI::enterprises.9.9.48.1.1.1.4.1 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.48.1.1.1.4.14 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.48.1.1.1.5.1 = Gauge32: 195210248
SNMPv2-SMI::enterprises.9.9.48.1.1.1.5.14 = Gauge32: 6294296
SNMPv2-SMI::enterprises.9.9.48.1.1.1.6.1 = Gauge32: 2037172136
SNMPv2-SMI::enterprises.9.9.48.1.1.1.6.14 = Gauge32: 832
SNMPv2-SMI::enterprises.9.9.48.1.1.1.7.1 = Gauge32: 1332474908
SNMPv2-SMI::enterprises.9.9.48.1.1.1.7.14 = Gauge32: 412
[root@bbb snmp]#


(6)  snmptranslate

可參考 http://net-snmp.sourceforge.net/tutorial/tutorial-5/commands/mib-options.html


[root@bbb /]#  snmptranslate  1.3.6.1.4.1.9.9.48
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolMIB
[root@bbb /]#


未載入  CISCO-MEMORY-POOL-MIB

[root@bbb /]#  snmptranslate  1.3.6.1.4.1.9.9.48
SNMPv2-SMI::enterprises.9.9.48

[root@bbb /]#  snmptranslate  -IR -On ciscoMemoryPoolMIB
Unknown object identifier: ciscoMemoryPoolMIB
[root@bbb /]#

指定載入  CISCO-MEMORY-POOL-MIB

[root@bbb /]#  snmptranslate -m CISCO-MEMORY-POOL-MIB  -IR -Onf ciscoMemoryPoolMIB
.iso.org.dod.internet.private.enterprises.cisco.ciscoMgmt.ciscoMemoryPoolMIB

或預設載入  CISCO-MEMORY-POOL-MIB

[root@bbb /]# snmptranslate  -IR -On ciscoMemoryPoolMIB
.1.3.6.1.4.1.9.9.48

[root@bbb /]# snmptranslate  .1.3.6.1.4.1.9.9.48
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolMIB
[root@bbb /]#

OIDs 的二種表示法

[root@bbb /]# snmptranslate  -IR -Onf ciscoMemoryPoolMIB
.iso.org.dod.internet.private.enterprises.cisco.ciscoMgmt.ciscoMemoryPoolMIB

[root@bbb /]# snmptranslate  -IR -On ciscoMemoryPoolMIB
.1.3.6.1.4.1.9.9.48
[root@bbb /]#

(7)SNMP OIDs Tree [ CISCO-MEMORY-POOL-MIB  ]

[root@bbb /]# snmptranslate -Tp -m  CISCO-MEMORY-POOL-MIB  
+--iso(1)
   |
   +--org(3)
      |
      +--dod(6)
         |
         +--internet(1)
            |
            +--directory(1)
            |
            +--mgmt(2)
            |  |
            |  +--mib-2(1)
            |     |
            |     +--transmission(10)
            |
            +--experimental(3)
            |
            +--private(4)
            |  |
            |  +--enterprises(1)
            |     |
            |     +--cisco(9)
            |        +--ciscoProducts(1)
            |        +--local(2)
            |        +--temporary(3)
            |        +--pakmon(4)
            |        +--workgroup(5)
            |        +--otherEnterprises(6)
            |        |  +--ciscoSB(1)
            |        |  +--ciscoSMB(2)
            |        |
            |        +--ciscoAgentCapability(7)
            |        +--ciscoConfig(8)
            |        +--ciscoMgmt(9)
            |        |  +--ciscoMemoryPoolMIB(48)
            |        |     |
            |        |     +--ciscoMemoryPoolObjects(1)
            |        |     |  |
            |        |     |  +--ciscoMemoryPoolTable(1)
            |        |     |  |  |
            |        |     |  |  +--ciscoMemoryPoolEntry(1)
            |        |     |  |     |  Index: ciscoMemoryPoolType
            |        |     |  |     |
            |        |     |  |     +-- ---- Integer32 ciscoMemoryPoolType(1)
            |        |     |  |     |        Textual Convention: CiscoMemoryPoolTypes
            |        |     |  |     |        Range: 1..65535
            |        |     |  |     +-- -R-- String    ciscoMemoryPoolName(2)
            |        |     |  |     |        Textual Convention: DisplayString
            |        |     |  |     |        Size: 0..255
            |        |     |  |     +-- -R-- Integer32 ciscoMemoryPoolAlternate(3)
            |        |     |  |     |        Range: 0..65535
            |        |     |  |     +-- -R-- EnumVal   ciscoMemoryPoolValid(4)
            |        |     |  |     |        Textual Convention: TruthValue
            |        |     |  |     |        Values: true(1), false(2)
            |        |     |  |     +-- -R-- Gauge     ciscoMemoryPoolUsed(5)
            |        |     |  |     +-- -R-- Gauge     ciscoMemoryPoolFree(6)
            |        |     |  |     +-- -R-- Gauge     ciscoMemoryPoolLargestFree(7)
            |        |     |  |
            |        |     |  +--ciscoMemoryPoolUtilizationTable(2)
            |        |     |     |
            |        |     |     +--ciscoMemoryPoolUtilizationEntry(1)
            |        |     |        |
            |        |     |        +-- -R-- INTEGER   ciscoMemoryPoolUtilization1Min(1)
            |        |     |        |        Textual Convention: Percent
            |        |     |        |        Range: 0..100
            |        |     |        +-- -R-- INTEGER   ciscoMemoryPoolUtilization5Min(2)
            |        |     |        |        Textual Convention: Percent
            |        |     |        |        Range: 0..100
            |        |     |        +-- -R-- INTEGER   ciscoMemoryPoolUtilization10Min(3)
            |        |     |                 Textual Convention: Percent
            |        |     |                 Range: 0..100
            |        |     |
            |        |     +--ciscoMemoryPoolNotifications(2)
            |        |     |
            |        |     +--ciscoMemoryPoolConformance(3)
            |        |        |
            |        |        +--ciscoMemoryPoolCompliances(1)
            |        |        |  |
            |        |        |  +--ciscoMemoryPoolCompliance(1)
            |        |        |  +--ciscoMemoryPoolComplianceRev1(2)
            |        |        |
            |        |        +--ciscoMemoryPoolGroups(2)
            |        |           |
            |        |           +--ciscoMemoryPoolGroup(1)
            |        |           +--ciscoMemoryPoolUtilizationGroup(2)
            |        |
            |        +--ciscoExperiment(10)
            |        +--ciscoAdmin(11)
            |        |  +--ciscoProxy(1)
            |        |  |  |
            |        |  |  +--ciscoPartyProxy(1)
            |        |  |  |
            |        |  |  +--ciscoContextProxy(2)
            |        |  |
            |        |  +--ciscoRptrGroupObjectID(2)
            |        |  |  +--ciscoUnknownRptrGroup(1)
            |        |  |  +--cisco2505RptrGroup(2)
            |        |  |  +--cisco2507RptrGroup(3)
            |        |  |  +--cisco2516RptrGroup(4)
            |        |  |  +--ciscoWsx5020RptrGroup(5)
            |        |  |
            |        |  +--ciscoChipSets(3)
            |        |     +--ciscoChipSetSaint1(1)
            |        |     +--ciscoChipSetSaint2(2)
            |        |     +--ciscoChipSetSaint3(3)
            |        |     +--ciscoChipSetSaint4(4)


.............................

.............................


(8) 實戰透過 snmpwalk 取得 ciscoMemoryPool 資訊

可參考http://www.oidview.com/mibs/9/CISCO-MEMORY-POOL-MIB.html

以   Processor Memory Pool 及 lsmpi_io Memory Pool 為例

[root@bbb /]# snmptranslate  -IR -Onf ciscoMemoryPoolName
.iso.org.dod.internet.private.enterprises.cisco.ciscoMgmt.ciscoMemoryPoolMIB.ciscoMemoryPoolObjects.ciscoMemoryPoolTable.ciscoMemoryPoolEntry.ciscoMemoryPoolName

或


[root@bbb /]# snmptranslate -m CISCO-MEMORY-POOL-MIB  -IR -Onf ciscoMemoryPoolName
.iso.org.dod.internet.private.enterprises.cisco.ciscoMgmt.ciscoMemoryPoolMIB.ciscoMemoryPoolObjects.ciscoMemoryPoolTable.ciscoMemoryPoolEntry.ciscoMemoryPoolName

[root@bbb /]# snmptranslate -m CISCO-MEMORY-POOL-MIB  -IR -On ciscoMemoryPoolName
.1.3.6.1.4.1.9.9.48.1.1.1.2
[root@bbb /]#


或

[root@bbb ~]#  snmpwalk -c public -v2c     192.168.111.158   1.3.6.1.4.1.9.9.48
SNMPv2-SMI::enterprises.9.9.48.1.1.1.2.1 = STRING: "Processor"
SNMPv2-SMI::enterprises.9.9.48.1.1.1.2.14 = STRING: "lsmpi_io"
SNMPv2-SMI::enterprises.9.9.48.1.1.1.3.1 = INTEGER: 0
SNMPv2-SMI::enterprises.9.9.48.1.1.1.3.14 = INTEGER: 0
SNMPv2-SMI::enterprises.9.9.48.1.1.1.4.1 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.48.1.1.1.4.14 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.48.1.1.1.5.1 = Gauge32: 195206240
SNMPv2-SMI::enterprises.9.9.48.1.1.1.5.14 = Gauge32: 6294296
SNMPv2-SMI::enterprises.9.9.48.1.1.1.6.1 = Gauge32: 2037176144
SNMPv2-SMI::enterprises.9.9.48.1.1.1.6.14 = Gauge32: 832
SNMPv2-SMI::enterprises.9.9.48.1.1.1.7.1 = Gauge32: 1332474908
SNMPv2-SMI::enterprises.9.9.48.1.1.1.7.14 = Gauge32: 412



[root@bbb /]#  snmpwalk -c public -v2c  192.168.111.158 .1.3.6.1.4.1.9.9.48
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.1 = STRING: Processor
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.14 = STRING: lsmpi_io
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolAlternate.1 = INTEGER: 0
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolAlternate.14 = INTEGER: 0
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolValid.1 = INTEGER: true(1)
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolValid.14 = INTEGER: true(1)
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.1 = Gauge32: 195210248 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.14 = Gauge32: 6294296 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.1 = Gauge32: 2037172136 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.14 = Gauge32: 832 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolLargestFree.1 = Gauge32: 1332474908 bytes
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolLargestFree.14 = Gauge32: 412 bytes
[root@bbb /]#



[root@bbb /]# snmpwalk -c public -v2c     192.168.111.158   1.3.6.1.4.1.9.9.48.1.1.1.2
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.1 = STRING: Processor
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName.14 = STRING: lsmpi_io


Processor MemoryPool


[root@bbb /]#  snmpwalk -c public -v2c     192.168.111.158   1.3.6.1.4.1.9.9.48.1.1.1.5.1
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.1 = Gauge32: 195206240 bytes
[root@bbb log]#

[root@bbb /]#  snmpwalk -c public -v2c     192.168.111.158   1.3.6.1.4.1.9.9.48.1.1.1.6.1
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.1 = Gauge32: 2037176144 bytes



lsmpi_io MemoryPool


[root@bbb /]#  snmpwalk -c public -v2c     192.168.111.158   1.3.6.1.4.1.9.9.48.1.1.1.5.14
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.14 = Gauge32: 6294296 bytes


[root@bbb /]#  snmpwalk -c public -v2c     192.168.111.158   1.3.6.1.4.1.9.9.48.1.1.1.6.14
CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.14 = Gauge32: 832 bytes



對照 Cicso 設備下指令顯示的資訊,看到的資訊應該跟 snmpget 到的資訊差不多才是


Router#show memory 
                Head    Total(b)     Used(b)     Free(b)   Lowest(b)  Largest(b)
Processor  7F4216AD6010   2232382384   195274364   2037108020   2036934440   1332474908
 lsmpi_io  7F41C34CE1A8     6295128     6294304         824         824         412
....
....


---End


Cacti Demo
















































加碼 Demo

FortiGate SNMP OIDs

fgSysDiskUsage 1.3.6.1.4.1.12356.101.4.1.6
fgSysDiskCapacity 1.3.6.1.4.1.12356.101.4.1.7

FortiGate CLI

FortiGateCMD#dia sys logdisk usage


http://www.oidview.com/mibs/12356/FORTINET-FORTIGATE-MIB.html



[root@bbb mibs]# snmptranslate -m FORTINET-FORTIGATE-MIB  -IR -Onf fgSysDiskUsage
.iso.org.dod.internet.private.enterprises.fortinet.fnFortiGateMib.fgSystem.fgSystemInfo.fgSysDiskUsage

[root@bbb mibs]# snmptranslate -m FORTINET-FORTIGATE-MIB  -IR -On fgSysDiskUsage
.1.3.6.1.4.1.12356.101.4.1.6
[root@bbb mibs]#


[root@bbb mibs]# snmptranslate -m FORTINET-FORTIGATE-MIB  -IR -Onf fgSysDiskCapacity
.iso.org.dod.internet.private.enterprises.fortinet.fnFortiGateMib.fgSystem.fgSystemInfo.fgSysDiskCapacity

[root@bbb mibs]# snmptranslate -m FORTINET-FORTIGATE-MIB  -IR -On  fgSysDiskCapacity
.1.3.6.1.4.1.12356.101.4.1.7
[root@bbb mibs]#


FortiGate




































FortiGate











Cacti




2017年2月1日 星期三

Cacti 1.0.0 試裝

在 2017 年過農曆年期間,Cacti 1.0.0 已在官網上釋出, http://www.cacti.net
新版的 1.0.x  跟以往 0.8.x 有很大的不同,

其中 plugin 部份已內建許多常用的套件,而且許多舊版的 plugin ,
亦無法在新版的 1.0.0 上使用.而且在安裝時 MySQL 的 版本不能
低於 5.6.x ,另需在 my.cnf 加入許多調校的參數設定等等...
這都是跟以往有著些許的不同之處!


README.md

# Cacti 1.0.0

With the release of Cacti 1.0.0 many improvements and enhancements have been
made.As part of ongoing efforts to improve Cacti almost 20 plugins were merged
into the core of Cacti eliminating the need for the plugins. A major refresh of the
interface has been started and will continue to occur as development on Cacti
continues.

### Plugins Absorbed into the Core

The following plugins have been merged into the core Cacti code
as of version 1.0.0:

| Plugin      | Description                                              |
| ----------- | -------------------------------------------------------- |
| snmpagent   | An SNMP Agent extension, trap and notification generator |
| clog        | Log viewers for administrators                           |
| settings    | Core plugin providing email and DNS services             |
| boost       | Large system performance boost plugin                    |
| dsstats     | Cacti data source statistics                             |
| watermark   | Watermark graphs                                         |
| ssl         | Force https connection                                   |
| ugroup      | User groups support                                      |
| domains     | Multiple authentication domains                          |
| jqueryskin  | User interface skinning                                  |
| secpass     | C3 level password and site security                      |
| logrotate   | Log management                                           |
| realtime    | Realtime graphing                                        |
| rrdclean    | RRD file maintenance                                     |
| nectar      | Email based graph reporting                              |
| aggregate   | Templating, creation and management of aggregate graphs  |
| autom8      | Graph and Tree creation automation                       |
| discovery   | Network Discovery and Device automation                  |
| spikekill   | Removes spikes from Graphs                               |
| superlinks  | Allows administrators to links to additional sites       |

-----------------------------------------------------------------------------


目前支援新版的 plugin 可在 github 上取得.

https://github.com/Cacti/


Cacti 1.0.0 試裝的 LAB 資訊

[root@centos73 plugins]# pwd
/var/www/html/cacti/plugins
[root@centos73 plugins]# ll
total 12
drwxr-xr-x 5 cactiuser apache  267 Feb  2 13:47 hmib
-rw-r--r-- 1 cactiuser apache   44 Feb  2 11:47 index.php
drwxr-xr-x 3 cactiuser apache  148 Feb  2 13:45 maint
drwxr-xr-x 5 cactiuser apache  188 Feb  2 13:36 monitor
drwxr-xr-x 7 cactiuser apache 4096 Feb  2 13:33 thold
drwxr-xr-x 4 cactiuser apache 4096 Feb  2 13:46 webseer
[root@centos73 plugins]#

[root@centos73 plugins]# mysql -V
mysql  Ver 15.1 Distrib 10.1.21-MariaDB, for Linux (x86_64) using readline 5.1

[root@centos73 plugins]# php -v
PHP 5.4.16 (cli) (built: Nov  6 2016 00:29:02)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

[root@centos73 plugins]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

Demo









































































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