##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. Sass初入门

    什么是CSS预处理器? CSS预处理器定义了一种新的语言,其基本思想是,用一种专门的编程语言,为CSS增加了一些编程的特性,将CSS作为目标生成文件,然后开发者就只要使用这种语言进行编码工作.   什 ...

  2. 十九、CSS如何引入字体

    将相应的字体放入新建的文件夹,然后在Css文件里面如下图引入 @font-face { font-family: FZLTCXHJW; src: url(../font/FZYouHJW_Xian_a ...

  3. 添加CentOS扩展源

    参考: http://blog.onovps.com/archives/centos-yum-epel.html https://fedoraproject.org/wiki/EPEL/zh-cn h ...

  4. sqlserver数据库使用空间监控

    数据库使用空间监控,并且每周发邮件预警,下面是操作步骤: 1:建立一张表 ), database_name ), file_group ), logical_name ), physical_name ...

  5. windows下安装配置RabbitMQ

    安装部署 1.当前环境以及参考资料出处 部署环境:windows server 2008 r2 enterprise 官方安装部署文档:http://www.rabbitmq.com/install- ...

  6. 【Leetcode】【Medium】Find Peak Element

    A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ ...

  7. mongo 聚合函数

    一: 聚合 常见的聚合操作跟sql server一样,有:count,distinct,group,mapReduce. <1> count count是最简单,最容易,也是最常用的聚合工 ...

  8. AutoHotkey调用VBA实现批量精确筛选数据透视表某字段内容。

    如上图,想在数据透视表中只显示红色区域的内容,手动勾选就比较繁琐. 实现思路: 先复制红色的内容. 鼠标停留在数据透视表[型号]列的任意数据上(通过该单元格可以获取数据透视表和字段) 由于数据透视表的 ...

  9. UNIX和linux系统性能监控工具oswatcher

    可以在一台机器上运行oswatcher.把运行的结果拷贝到有vnc的机器上进行分析.java -jar oswbba.jar -i /mnt/hgfs/database/oswbb/archive . ...

  10. GO语言(四)线程通信

    package main import "fmt" func fibon(c,quit chan int) { x,y := , for { select { case c < ...