public class ZabbixParseDataServiceImpl implements ZabbixParseDataService {
private static final CookieManager MANAGER;
private static final String ZABBIX_FILE="";
private static final String LOGIN_URL="http://jinrongzabbix.cnsuning.com/index.php";
private static final String AGENT_STR = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.146 Safari/537.36";
private static final String DATA_URL="http://jinrongzabbix.cnsuning.com/latest.php?groupid=#{GROUPID}&hostid=0";
private static final String GROUD_ID_STR = "groupId";
private static final Logger log = LoggerFactory.getLogger(ZabbixParseDataServiceImpl.class);
@Autowired
private PaymentRedisUtilService paymentRedisUtilService;
@Autowired
private ZabbixParseInfoDao zabbixParseInfoDao;
static {
MANAGER = new CookieManager();
MANAGER.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
CookieHandler.setDefault(MANAGER);
}
/**
* 解析zabbix的数据
* @return
*/
@Override
public void parseZabbixData(){
log.info("zabbix获取数据开始。");
String resultStr= null;
try {
Map resultMap=getZabbixData();
log.info("zabbix数据存redis中参数{}:"+JSONObject.toJSONString(resultMap));
resultStr = paymentRedisUtilService.hmset(CommonConstants.REDIS_ZABBIX_KEY,resultMap);
} catch (Exception e) {
log.error("zabbix数据获取并存redis中出现异常。",e);
}
log.info("zabbix数据存redis中结果为:"+resultStr);
log.info("zabbix获取数据结束。");
}
/**
* zabbix获取一键付统计数据
*/
@Override
public void parserZabbixData4DisposablePay() {
log.info("zabbix获取一键付统计数据开始");
List