Rev 23738 | Rev 23794 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.smartdukaan.cron.monitored;import java.util.HashMap;import java.util.Map;import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Component;import com.spice.profitmandi.common.enumuration.SchemeType;import com.spice.profitmandi.common.web.client.RestClient;import com.spice.profitmandi.dao.repository.catalog.ItemRepository;@Componentpublic class NagiosMonitorTasks {private static final Logger log = LogManager.getLogger(NagiosMonitorTasks.class);@Autowiredprivate RestClient restClient;@AutowiredItemRepository itemRepository;public void reportSmsCount() throws Throwable {String htmlpage;int currentBalance = 0;String uri = "/MessagingGateway/LoginAction";Map<String, String> params = new HashMap<>();params.put("user", "srlsaholic");params.put("password", "sr18mar");String response = restClient.post(SchemeType.HTTP, "103.15.179.45", 8085, uri, params, new HashMap<>());// System.out.println("response Html"+response);if (response.length() > 0) {htmlpage = response.substring(response.indexOf("Current Balance"), response.indexOf("</div>")).substring((response.substring(response.indexOf("Current Balance"), response.indexOf("</div>")).indexOf(">"))+ 1,response.substring(response.indexOf("Current Balance"), response.indexOf("</div>")).length()).trim();/// System.out.println(htmlpage);currentBalance = Integer.parseInt(htmlpage);log.info("Got successfully parsed {}", currentBalance);}}}