Fix testing state sensor index dumping order. (#8117)

Add netonix state sensor test data
This commit is contained in:
Tony Murray
2018-01-21 07:43:10 -06:00
committed by GitHub
parent 89c1c2e810
commit f7941797b6
4 changed files with 388 additions and 1 deletions

View File

@@ -583,7 +583,13 @@ class ModuleTestHelper
}
}
$rows = dbFetchRows("SELECT * FROM `$table` $join $where", $params);
if (isset($info['order_by'])) {
$order_by = " ORDER BY {$info['order_by']}";
} else {
$order_by = '';
}
$rows = dbFetchRows("SELECT * FROM `$table` $join $where $order_by", $params);
// remove unwanted fields
if (isset($info['included_fields'])) {

View File

@@ -16,5 +16,371 @@
]
},
"poller": "matches discovery"
},
"sensors": {
"discovery": {
"sensors": [
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.1",
"sensor_index": "1",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 1 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "1",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.2",
"sensor_index": "2",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 2 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "5",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.3",
"sensor_index": "3",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 3 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "2",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.4",
"sensor_index": "4",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 4 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "2",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.5",
"sensor_index": "5",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 5 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "1",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.6",
"sensor_index": "6",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 6 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "1",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.7",
"sensor_index": "7",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 7 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "4",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.8",
"sensor_index": "8",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 8 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "1",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.9",
"sensor_index": "9",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 9 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "3",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.10",
"sensor_index": "10",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 10 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "1",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.11",
"sensor_index": "11",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 11 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "1",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.12",
"sensor_index": "12",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 12 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "1",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.13",
"sensor_index": "13",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 13 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "1",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
},
{
"sensor_deleted": "0",
"sensor_class": "state",
"poller_type": "snmp",
"sensor_oid": ".1.3.6.1.4.1.46242.5.1.2.14",
"sensor_index": "14",
"sensor_type": "netonixPoeStatus",
"sensor_descr": "Port 14 PoE",
"sensor_divisor": "1",
"sensor_multiplier": "1",
"sensor_current": "1",
"sensor_limit": null,
"sensor_limit_warn": null,
"sensor_limit_low": null,
"sensor_limit_low_warn": null,
"sensor_alert": "1",
"sensor_custom": "No",
"entPhysicalIndex": null,
"entPhysicalIndex_measured": null,
"sensor_prev": null,
"user_func": null,
"state_name": "netonixPoeStatus"
}
],
"state_indexes": [
{
"state_name": "netonixPoeStatus",
"state_descr": "Off",
"state_draw_graph": "0",
"state_value": "1",
"state_generic_value": "-1"
},
{
"state_name": "netonixPoeStatus",
"state_descr": "24V",
"state_draw_graph": "0",
"state_value": "2",
"state_generic_value": "0"
},
{
"state_name": "netonixPoeStatus",
"state_descr": "48V",
"state_draw_graph": "0",
"state_value": "3",
"state_generic_value": "0"
},
{
"state_name": "netonixPoeStatus",
"state_descr": "24VH",
"state_draw_graph": "0",
"state_value": "4",
"state_generic_value": "0"
},
{
"state_name": "netonixPoeStatus",
"state_descr": "48VH",
"state_draw_graph": "0",
"state_value": "5",
"state_generic_value": "0"
}
]
},
"poller": "matches discovery"
}
}

View File

@@ -41,6 +41,7 @@ sensors:
joins:
- { left: state_indexes.state_index_id, right: state_translations.state_index_id }
- { custom: 'INNER JOIN ( SELECT i.state_index_id FROM `sensors_to_state_indexes` i LEFT JOIN `sensors` s ON (i.`sensor_id` = s.`sensor_id`) WHERE `device_id`=? GROUP BY i.state_index_id) d ON d.state_index_id = state_indexes.state_index_id' }
order_by: state_indexes.state_name, state_translations.state_value
custom_where: ''
storage:
storage:

View File

@@ -1,3 +1,17 @@
1.3.6.1.2.1.1.1.0|4|Netonix WS-12-250-AC
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.46242
1.3.6.1.4.1.2021.11.11.0|2|81
1.3.6.1.4.1.46242.5.1.2.1|2|1
1.3.6.1.4.1.46242.5.1.2.2|2|5
1.3.6.1.4.1.46242.5.1.2.3|2|2
1.3.6.1.4.1.46242.5.1.2.4|2|2
1.3.6.1.4.1.46242.5.1.2.5|2|1
1.3.6.1.4.1.46242.5.1.2.6|2|1
1.3.6.1.4.1.46242.5.1.2.7|2|4
1.3.6.1.4.1.46242.5.1.2.8|2|1
1.3.6.1.4.1.46242.5.1.2.9|2|3
1.3.6.1.4.1.46242.5.1.2.10|2|1
1.3.6.1.4.1.46242.5.1.2.11|2|1
1.3.6.1.4.1.46242.5.1.2.12|2|1
1.3.6.1.4.1.46242.5.1.2.13|2|1
1.3.6.1.4.1.46242.5.1.2.14|2|1