mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Give slightly more information on Transport API failure.
This commit is contained in:
		@@ -41,7 +41,7 @@ foreach( $opts as $method=>$apis ) {
 | 
			
		||||
            var_dump("API '$host' returned Error"); //FIXME: propper debuging
 | 
			
		||||
            var_dump("Params: ".$api); //FIXME: propper debuging
 | 
			
		||||
            var_dump("Return: ".$ret); //FIXME: propper debuging
 | 
			
		||||
            return false;
 | 
			
		||||
            return 'HTTP Status code '.$code;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,10 @@ foreach($opts as $option) {
 | 
			
		||||
    }
 | 
			
		||||
    $curl = curl_init();
 | 
			
		||||
 | 
			
		||||
    if (empty($obj["msg"])) {
 | 
			
		||||
        return "Empty Message";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (empty($option["message_format"])) {
 | 
			
		||||
        $option["message_format"] = 'text';
 | 
			
		||||
    }
 | 
			
		||||
@@ -60,7 +64,7 @@ foreach($opts as $option) {
 | 
			
		||||
        var_dump("API '$url' returned Error");
 | 
			
		||||
        var_dump("Params: " . $message);
 | 
			
		||||
        var_dump("Return: " . $ret);
 | 
			
		||||
        return false;
 | 
			
		||||
        return 'HTTP Status code '.$code;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -48,6 +48,6 @@ $ret = curl_exec($curl);
 | 
			
		||||
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
 | 
			
		||||
if( $code != 200 ) {
 | 
			
		||||
    var_dump("PagerDuty returned Error, retry later"); //FIXME: propper debuging
 | 
			
		||||
    return false;
 | 
			
		||||
    return 'HTTP Status code '.$code;
 | 
			
		||||
}
 | 
			
		||||
return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -42,6 +42,6 @@ if( $code > 201 ) {
 | 
			
		||||
    if( $debug ) {
 | 
			
		||||
        var_dump($ret);
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
    return 'HTTP Status code '.$code;
 | 
			
		||||
}
 | 
			
		||||
return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -86,7 +86,7 @@ foreach( $opts as $api ) {
 | 
			
		||||
    $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
 | 
			
		||||
    if( $code != 200 ) {
 | 
			
		||||
        var_dump("Pushover returned error"); //FIXME: proper debugging
 | 
			
		||||
        return false;
 | 
			
		||||
        return 'HTTP Status code '.$code;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ foreach( $opts as $tmp_api ) {
 | 
			
		||||
        var_dump("API '$host' returned Error"); //FIXME: propper debuging
 | 
			
		||||
        var_dump("Params: ".$alert_message); //FIXME: propper debuging
 | 
			
		||||
        var_dump("Return: ".$ret); //FIXME: propper debuging
 | 
			
		||||
        return false;
 | 
			
		||||
        return 'HTTP Status code '.$code;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
return true;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user