##Background

My co-worker told me he needed to monitor UPS with SNMP module but he only can get hexadecimal digits from UPS module with SNMPWALK commands. Then I had to turn hexadecimal  to decimal.
He gave me a passage about IEEE754: http://www.softelectro.ru/ieee754_en.html
C  12    F  15
B 11 E 14 C2 05 FB EE 1100 0010 0000 0101 1111 1011 1110 1110 1 = negative "-" 1
1000 01000
0101 1111 1011 1110 1110 1000 0100 = 132 - 127 = 5 so 2^5 = 32 0000 1011 1111 0111 1101 110 = 392174, so 392174/2^23 = 0.0467507 fomula = - 2^5 x (1+0.0467507) = -33.4 0101 1111 1011 1110 1110 = 392174 C205FBEE

Python Script

#!/usr/bin/env python
#-*- coding:utf-8 -*-
var = input("Please enter dec number:")
b = bin(int(var, 16))
print(b)
S = int(b[2])
#print(S)
e = b[3:11]
#print(e) E = int(e, 2)
#print(E) m = b[12:]
#print(m)
M = int(m, 2)
#print(M) F = ((-1)**S)*(2**(E-127))*(1+M/(2**23))
print(round(F, 10))
												

Python Monitoring UPS with SNMPWALK的更多相关文章

  1. 查看进程的io

    linux系统上可以使用(centos 2.6.18-144开始支持),dstat版本至少是:dstat-0.6.7-1.rf.noarch.rpm安装wget -c http://linux.web ...

  2. linux wa%过高,iostat查看io状况

    命令总结: 1. top/vmstat 发现 wa%过高,vmstat b >1: 参考文章: 1. 关于Linux系统指令 top 之 %wa 占用高,用`iostat`探个究竟 最近测试一项 ...

  3. rrdtool ubuntu python snmpwalk

    rrdtool install: apt-get install libpango1.0-dev libxml2-dev wget https://packages.debian.org/wheezy ...

  4. Python运维脚本整理

    Python 实现的自动化服务器管理 import sys import os import paramiko ssh = paramiko.SSHClient() ssh.set_missing_h ...

  5. python常用运维脚本实例

    转载  file是一个类,使用file('file_name', 'r+')这种方式打开文件,返回一个file对象,以写模式打开文件不存在则会被创建.但是更推荐使用内置函数open()来打开一个文件 ...

  6. 转:python常用运维脚本实例

    python常用运维脚本实例 转载  file是一个类,使用file('file_name', 'r+')这种方式打开文件,返回一个file对象,以写模式打开文件不存在则会被创建.但是更推荐使用内置函 ...

  7. python常用运维脚本实例【转】

    file是一个类,使用file('file_name', 'r+')这种方式打开文件,返回一个file对象,以写模式打开文件不存在则会被创建.但是更推荐使用内置函数open()来打开一个文件 . 首先 ...

  8. Sensitive directory/file Integrity Monitoring and Checking

    catalogue . OSSEC . HashSentry: Host-Based IDS in Python . Afick . 检测流程 1. OSSEC OSSEC is an Open So ...

  9. Python检测服务端口存活状态并报警

    最近发现公司的测试环境中有个Socket服务的端口总是莫名其妙Down掉,但是服务却正常运行着,看样子是僵死了... 虽然是测试环境,但是也不能这样放着不管,于是连夜写了一个简单的监控脚本.因为服务器 ...

随机推荐

  1. awk获取外部变量

    语法 awk [ -F re] [parameter...] ['pattern {action}' ] [-f progfile][in_file...] 获得普通外部变量 [xingxing.dx ...

  2. IE8下的怪异模式

    使用DWZ框架,老是出现点击button后在winxp IE8下出现新页面,经过检查后发现IE8下submit后,return false就不行了,必须使用window.event.returnVal ...

  3. C#链接数据库:SQL Server 2008

    自己学习C#编程,在WinForm编程中,代码测试连接数据库. 现在sqlserver中测试使用的数据库能否以指定的用户名和密码登录. 如图所示,计算机名为administrator,数据库实例为sq ...

  4. Python爬虫教程-22-lxml-etree和xpath配合使用

    Python爬虫教程-22-lxml-etree和xpath配合使用 lxml:python 的HTML/XML的解析器 官网文档:https://lxml.de/ 使用前,需要安装安 lxml 包 ...

  5. 六、使用media实现响应式布局

    常见写法: 下面总结常见的响应式布局的分类: @media screen and (max-width:320px){ #talkFooter .editArea{…… } } @media scre ...

  6. 【NLP_Stanford课堂】情感分析

    一.简介 实例: 电影评论.产品评论是positive还是negative 公众.消费者的信心是否在增加 公众对于候选人.社会事件等的倾向 预测股票市场的涨跌 Affective States又分为: ...

  7. javascript 时间日期处理相加,减操作方法js

    javascript 时间日期处理相加,减操作方法js function dateAddDays(dataStr,dayCount){ var strdate = dataStr; // 2017年0 ...

  8. Oracle物化视图详解

    现实工作中会有多个数据源同步到一个数据库完成数据分析的场景,这些数据可以不是实时同步的,我们一般通过定时任务抽取数据到统计分析库给应用使用. 一般的同步方式可以通过时间戳做全量和增量数据同步(存在原数 ...

  9. WCF安全 z

    WCF custom authentication using ServiceCredentials The generally accepted way of authenticating a us ...

  10. 新款Macbook 安装任意来源软件教程 mac软件下载资源推荐

    防止无良爬虫,开头附上原文链接:http://www.cnblogs.com/xueyudlut/p/7810981.html ------分割线--------------------------- ...