| Line 87... |
Line 87... |
| 87 |
|
87 |
|
| 88 |
public void reportSmsCount() throws Throwable {
|
88 |
public void reportSmsCount() throws Throwable {
|
| 89 |
String htmlpage;
|
89 |
String htmlpage;
|
| 90 |
int currentSmsCount = 0;
|
90 |
int currentSmsCount = 0;
|
| 91 |
LinkedHashMap<String, String> propertiesDetails = new LinkedHashMap<>();
|
91 |
LinkedHashMap<String, String> propertiesDetails = new LinkedHashMap<>();
|
| 92 |
String uri = "/MessagingGateway/LoginAction";
|
92 |
String uri = "/MessagingGateway/GetSMSBalance";
|
| 93 |
Map<String, String> params = new HashMap<>();
|
93 |
Map<String, String> params = new HashMap<>();
|
| 94 |
params.put("user", "srlsaholic");
|
94 |
params.put("Username", "srlsaholic");
|
| 95 |
params.put("password", "sr18mar");
|
95 |
params.put("Password", "sr18mar");
|
| 96 |
String response = restClient.post(SchemeType.HTTP, "103.15.179.45", 8085, uri, params, new HashMap<>());
|
96 |
String response = restClient.post(SchemeType.HTTP, "103.15.179.45", 8085, uri, params, new HashMap<>());
|
| 97 |
// System.out.println("response Html"+response);
|
97 |
// System.out.println("response Html"+response);
|
| 98 |
if (response.length() > 0) {
|
98 |
if (response.length() > 0) {
|
| 99 |
htmlpage = response.substring(response.indexOf("Current Balance"), response.indexOf("</div>")).substring(
|
99 |
htmlpage = response.substring(response.indexOf("=")+1);
|
| 100 |
(response.substring(response.indexOf("Current Balance"), response.indexOf("</div>")).indexOf(">"))
|
- |
|
| 101 |
+ 1,
|
- |
|
| 102 |
response.substring(response.indexOf("Current Balance"), response.indexOf("</div>")).length())
|
- |
|
| 103 |
.trim();
|
- |
|
| 104 |
/// System.out.println(htmlpage);
|
100 |
System.out.println(htmlpage);
|
| 105 |
currentSmsCount = Integer.parseInt(htmlpage);
|
101 |
currentSmsCount = Integer.parseInt(htmlpage);
|
| 106 |
log.info("Got successfully parsed {}", currentSmsCount);
|
102 |
log.info("Got successfully parsed {}", currentSmsCount);
|
| 107 |
propertiesDetails.put("currentSmsCount", Integer.toString(currentSmsCount));
|
103 |
propertiesDetails.put("currentSmsCount", Integer.toString(currentSmsCount));
|
| 108 |
writeToPropertiesFile.saveParamChanges(propertiesDetails, nagiosPropertiesFile);
|
104 |
writeToPropertiesFile.saveParamChanges(propertiesDetails, nagiosPropertiesFile);
|
| 109 |
|
105 |
|