量化感知一切IT设备: 使用脚本监控PDU

PDU: Power Distribution Unit 电源分配单元 在REMS2的实施过程中,我们遇到了这样的需求: 客户需要监控很多台PDU的指标,所使用的PDU有一个WEB访问接口,输入用户名和口令后可以进行PDU的远程操作和状态查看. PDU并没有SNMP服务之类功能. 该类型PDU能够提供4个监控指标: 电流,电压,功率,温度.思路: 在Script中模拟浏览器访问(模拟用户名口令输入,查看指标页面), 对于获取到的HTML代码使用python进行处理. 效果: $ ./mon_pdu.py -h   Usage: mon_pdu.py [options]     Options: -h, --help show this help message and exit -H HOST, --host=HOST pdu admin address -p PORT, --port=PORT pdu admin port -u USER, --user=USER pdu admin username -P PASSWORD, --passwd=PASSWORD pdu admin password

Getting Started with Logstach 2

Parsing Logs with Logstash 之前,我们已经通过一个最基础的Logstash pipeline,验证了我们的Logstash环境已经准备就绪。在现实世界里,那样基础的pipeline没有什么存在的价值,我们需要更加复杂的pipeline:一般都会包含多个input、filter以及output插件。 在这个章节,我们会创建一个Logstash pipeline,使用Filebeat读取Apache的日志作为输入,并对日志进行解析、创建指定的命名字段信息,再将解析过的数据写入到Elasticsearch。这次不在命令行中配置pipeline,咱使用配置文件。 开始之前,下载sample数据,在接下来会用。 配置Filebeat,将日志信息发送给Logstash 开始创建Logstash pipeline前,得先配置Filebeat,负责将日志中的文本行发送给Logstash。Filebeat用来搜集服务器上的文件,并转发给Logstash示例进行处理。Filebeat具备可靠、低延迟的设计特性 默认的Logstash安装会包含Beats input插件。这个插件让Logstash具备接收Elastic Beats框架发来的 事件 ,诸如PacketBeat、MetricBeat都可以向Logstash发送 事件  本文略过Filebeat的安装过程。 安装好Filebeat后,需要为Filebeat提供配置文件。Filebeat配置文件使用YAML格式。创建filebeat.yml文件,内容如下: filebeat.prospectors: \- type: log paths: \- /path/to/file/logstash-tutorial.log output.logstash: hosts: \[“localhost:5043\] 为了简化配置,这里没有使用TLS/SSL设置——真实世界里,我们需要安全设置。 启动Filebeat: sudo ./filebeat -e -c filebeat.yml -d “publish” Filebeat会尝试连接5043端口,因为目前为止,Logstash以及Beats plugin还没有启动,所以不会从这个端口得到应答。 配置Logstash来接受Filebeat输入 下面是Logstash pipeline的配置文件主干: ``` The # character at the beginning of a line indicates a comment. Use

Getting Started with Logstash 1

Stashing your first event 让我们启动logstash的学习! 通过运行一个最最基础的Logstash pipeline来验证一下我们的Logstash安装。  pipeline: 管道, 这个就是Linux/Unix中管道的概念。此处不做解释 Logstash 管道需要两个元素: input、output,经常还会配置可选元素:filter。 输入、过滤、输出,这就是一个标准的信息处理组件、很多个这种组件chain起来,就可以完成复杂的功能需求。在Logstash中,input、output、filter分别有许多plugin(插件),通过输入插件,从数据源中读取数据,filter插件按照配置修改数据,输出插件将数据写入目标端…… 为了测试我们安装的Logstash,我们来运行一个最基础的Logstash管道: logstash -e 'input { stdin {} } output { stdout {} }' 上例中,-e 选项让我们直接从命令行中获取logstash配置(一般是用配置文件的),这个基础示例中,我们从标准输入(stdin)中获取输入数据,将数据输出到标准输出(stdout)—— 输出时会使用logstash结构化后的格式(最起码得添加个时间戳对、主机名吧?) Logstash启动并不迅捷,等到看到“Pipeline main stated”才表示启动完毕,我们输入 hello word [2017-11-19T22:32:20,445][INFO ][logstash.pipeline ] Pipeline started {"pipeline.id"=>"main"} The stdin plugin is now waiting for input: [2017-11-19T22:32:20,471][INFO ][logstash.agent ] Pipelines running {:count=>1,

使用curl操作ElasticSearch初步

1. 列明现有的所有index curl -XGET 'localhost:9200/_cat/indices?v’ health status index uuid pri rep docs.count docs.deleted store.size pri.store.size yellow open .kibana bndJD_c9RYGzu7XuWDyK9w 1 1 2 0 8.4kb 8.4kb 2. 创建新的index curl -XPUT 'localhost:9200/customer?pretty' { "acknowledged" : true, "shards_acknowledged" : true, "index" : "customer" } 3. 添加文档、查询文档 curl -XPUT 'localhost:9200/customer/doc/1?pretty&pretty' -H 'Content-Type: application/json' -d' > { > "name": "John

当下可用的SDS-软件定义存储

哪一个是和Excelero的解决方案类似的呢?以后是不是企业就可以自己攒数据库一体机了……目前信息全面、真正可用的可能还是EMC ScaleIO Software-Defined Storage Apache Cassandra Apache Cassandra is a scalable, high-availability database for mission-critical applications. It runs on commodity hardware or cloud infrastructure and replicates across multiple data centers for lower latency and fault tolerance. Cassandra on GitHub Ceph Ceph is Red Hat’s distributed, highly scalable block, object, and file storage platform for enterprises

道德经

The quality that can be defined is not the Absolute Quality.The names that can be given it are not Absolute names.It is the origin of heaven and earth.When named it is the mother of all things...Quality (romantic Quality) and its manifestations (classic Quality) are in their nature the same. It is given different names (subject

重置weblogic管理账户密码

曾几何时,要重置weblogic密码,只需要在domain文件夹下,编辑一个boot.properties文件,里头写上: username=weblogic password=Welcome1重启weblogic,就能够把weblogic的密码修改为我们指定的Welcome1…… 那是多么美好、简单的年代——那时还是Bea weblogic!现如今,再这么做你会得到个BEA-000386错误,什么清空ldap文件夹之类的操作都不靠谱(具体什么版本起,不知道,我现在用的10.3.6是这样的)。 那么,下面我们来给出重置weblogic密码的“官方”方法: 1. 关闭domain,managed server,admin server 还有node manager;2. 为了后续操作方便,我们要设置几个环境变量 1) export MW_HOME=/home/Oracle/Middleware 2) export DOMAIN_HOME=$MW_HOME/user_projects/domains/base_domain 如果是windows平台,请使用set替代export3. 将管理server文件夹下的data文件夹改名为old_data,如: $DOMAIN_HOME/servers/AdminServer/data.这个操作主要是用来恢复现场的4. 执行source $DOMAIN_HOME/bin/setDomainEnv.sh5. cd $DOMAIN_HOME/security/6. mv DefaultAuthenticatorInit.ldift $DOMAIN_HOME/security/old 7. java weblogic.security.utils.AdminAccount weblogic welcome123 . weblogic是用户名,welcome123是密码, 不要遗漏最后面的”.”。8. 修改$DOMAIN_HOME/servers/AdminServer/security/boot.properties: username=weblogic password=welcome1239. $DOMAIN_HOME/startWeblogic.sh重新启动weblogic server

REMS2使用案例

庄总昨儿应某知名500强邀请,出去开了一天会议,今早一上班,赶紧看看一天不在,各系统是不是都还给力……     哎呦,上午10点20有情况,62个Active会话,客户们一定很着急,公司服务质量受影响,很严重啊 看看10:20那一会儿谁在造…… 还好,就10:29的时候,来了个高峰,过去了也就过去了…… 我得看看是谁在搞事,最近开发王经理彪呼呼的…… 哎呦,67%都是Application类别的堵塞啊,Application! 王大彪,我一会让你给我解释一下什么是Application…… 再瞅瞅具体什么原因造成的堵塞: 嗯,enq: TX - row lock contention ,这个字面意思就很清楚了,我百度一下…… 原来是“锁”等待啊,王大彪手下的那些个程序员,每天一下班我还没走就都跑了,怎么连数据库里基本的“锁”都管不好!! 这回SQL语句我都给你抓出来了,看你如何抵赖! 来,我们今儿就开个《关于如何提升应用代码质量、增强公司IT基础架构稳定性的会议》……