NetXMS Support Forum

Please login or register.

Login with username, password and session length

Author Topic: Wrong interface speed in DCI threshold script  (Read 119 times)

simplex

  • Newbie
  • *
  • Posts: 11
    • View Profile
Wrong interface speed in DCI threshold script
« on: March 25, 2019, 12:22:07 pm »

We use this script for interface load threshold
Code: [Select]
dci_instance = SplitString($dci->instance, ";");
node_interface_array = GetNodeInterfaces($node);
node_interface = node_interface_array[dci_instance[0]];
interface_speed = node_interface->speed;
trace(0, "DCI instance:" . dci_instance[0] .
" threshold on " . $node->name .
" : " . ($2 * interface_speed) . "<=" . $1 .
" = " . ($2 * interface_speed)<=$1);
if (($2 * interface_speed) <= $1)
return true;
return false;

some interfaces have wrong speed = 0.000000

Code: [Select]
2019.03.25 13:02:33.767 *I* DCI instance:11 threshold on 34760 : 750000000.000000<=11931472 = 0
2019.03.25 13:02:33.787 *I* DCI instance:12 threshold on 34760 : 0.000000<=366424 = 1
2019.03.25 13:02:33.807 *I* DCI instance:14 threshold on 34760 : 0.000000<=8077080 = 1
2019.03.25 13:02:33.827 *I* DCI instance:18 threshold on 34760 : 750000000.000000<=280684232 = 0

but in database and console has correct speed:

Code: [Select]
mysql> SELECT `id`, `speed` FROM interfaces WHERE `node_id` = 34760 AND `if_index` IN (12, 14);
+-------+------------+
| id    | speed      |
+-------+------------+
| 34772 | 1000000000 |
| 34774 | 1000000000 |
+-------+------------+
2 rows in set
Logged

simplex

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Wrong interface speed in DCI threshold script
« Reply #1 on: March 25, 2019, 12:37:14 pm »

we found mistake in array index:

Code: [Select]
node_interface = node_interface_array[dci_instance[0] - 1];
Logged