HipChat v2 integration not working

Running the latest version of LibreNMS (1.31.03-43-gf158a56) and trying to get HipChat working. I pulled the room ID (which HipChat calls “API ID”?) and API key from HipChat, and set up the WebGui as below:

When I click the transport button, it turns red and no message is sent to our HipChat room. I’ve tried various combinations of v1 and v2 commands, incorporating all parameters in the URL, etc. but nothing works.

Has anyone had success with this?

v2 is not supported afaik.

https://docs.librenms.org/Alerting/Transports/#hipchat

try https://api.hipchat.com/v2/rooms/message?auth_token=<my_auth_token>

check here also ->> How to alerting hipchat URL

@tenjj

The /opt/librenms/includes/alerts/transport.hipchat.php file seems to support v2:

// loop through each room
foreach($opts as $option) {
$version = 1;
if (stripos($option[‘url’], “v2”)) {
$version = 2;
}

// Generate our URL from the base URL + room_id and the auth token if the version is 2.
$url = $option['url'];
if ($version == 2) {
    $url .= "/".urlencode($option["room_id"])."/notification?auth_token=".urlencode($option["auth_token"]);
}
foreach($obj as $key=>$value) {
    $api = str_replace("%".$key, $method == "get" ? urlencode($value) : $value, $api);
}
$curl = curl_init();

if (empty($obj["msg"])) {
    return "Empty Message";
}

if (empty($option["message_format"])) {
    $option["message_format"] = 'text';
}

// Sane default of making the message color green if the message indicates
// that the alert recovered.   If it rebooted, make it yellow.
if(stripos($obj["msg"], "recovered")) {
    $color = "green";
} elseif(stripos($obj["msg"], "rebooted")) {
    $color = "yellow";
} else {
    if (empty($option["color"]) || $option["color"] == 'u') {
        $color = 'red';
    } else {
        $color = $option["color"];
    }
}

Not sure that’s valid anymore. If you look at the code in /opt/librenms/includes/alerts/transport.hipchat.php it looks for “v2” in the URL and then appends the necessary parameters:

// Generate our URL from the base URL + room_id and the auth token if the version is 2.
$url = $option[‘url’];
if ($version == 2) {
$url .= “/”.urlencode($option[“room_id”])."/notification?auth_token=".urlencode($option[“auth_token”]);
}
foreach($obj as $key=>$value) {
$api = str_replace("%".$key, $method == “get” ? urlencode($value) : $value, $api);
}
$curl = curl_init();

if (empty($obj[“msg”])) {
return “Empty Message”;
}

if (empty($option[“message_format”])) {
$option[“message_format”] = ‘text’;
}

// Sane default of making the message color green if the message indicates
// that the alert recovered. If it rebooted, make it yellow.
if(stripos($obj[“msg”], “recovered”)) {
$color = “green”;
} elseif(stripos($obj[“msg”], “rebooted”)) {
$color = “yellow”;
} else {
if (empty($option[“color”]) || $option[“color”] == ‘u’) {
$color = ‘red’;
} else {
$color = $option[“color”];
}
}
Reply
Bookmark Share Flag Reply
WatchingYou will receive notifications because you created this topic.
Suggested Topics
Topic Category Replies Views Activity
Source of Thresholds? new
Help
4 14 37m
Polling Warning - Devices polling time new
Help
3 6 1h
Read 3 sensors from HWg-STE2 unit new
snmp
Help
1 9 7h
UPS/PDU not graphing Amps/Volts/time new
Help
1 12 8h
Librenms Master new
Help
6 18 1d
There are 11 new topics remaining, or browse other topics in
Help

It should… But like the other post he had to till hit v1 or v2 in the URL with the token…so I don’t know if code issue :frowning:

Hipchat