Commit Graph

512 Commits

Author SHA1 Message Date
Neil Lathwood
ad6e82b3c7 fix: Fixed dump_db_schema / validate to work with newer versions of MariaDB (#7162)
* fix: Fixed dump_db_schema / validate to work with newer versions of MariaDB

* removed debug
2017-08-17 08:25:45 +01:00
Tony Murray
3ca6f84013 fix: bug in ipv62snmp function (#7135)
typo compressed instead of uncompressed
Tidied up the function and added unit tests.
2017-08-09 08:47:35 -05:00
Tony Murray
1d777693e1 feature: New IP parsing classes. Removes usage of Pear Net_IPv4 and Net_IPv6. (#7106)
* Refactor remove use of pear Net_IPv4 and Net_IPv6

Caution, I added tests to test the functionality of the new functions, but I'm not 100% certain the replaced usages match 100%.  Please test.

Left usage in generate-iplist.php because I'm not sure the use of that script, so I didn't want to implement additional functionality to support it.

Add support for ipv6 fo ipInNetwork() function

Add phpdocs to functions
Remove accidental inclusion

Use binary operations instead of string for networKFromIp()
Tidy up binary operations in ipInNetwork()

tidy parsing cidr network

Change to a class based implementation.

Update phpdocs.
Fully catch exceptions for hex parsing.

Fix mistake.

support older phpunit versions

Fix php shifting to negative with php 5

* Fix graph authorization. Uncaught exception and checking an ipv4 against an ipv6 network == fail.

* Also remove colons from hex strings.

* Fix typo in bgp polling
Two passes of removing invalid characters from hex strings. (That way we don't mangle valid IPs)
2017-08-08 14:14:58 -05:00
Neil Lathwood
c3627ec4e7 Merge pull request #7085 from murrant/device-status-event
fix: Add device status reason to up messages.
2017-08-01 21:49:15 +01:00
Tony Murray
f1fd01f276 Add device status reason to up messages. 2017-07-27 08:27:52 -05:00
Tony Murray
181b0fb7d5 refactor: Use the new locks for schema updates (#6931)
* Use the new locks for schema updates

* removed schema lock from discovery

* Add the ability to wait for a lock.
Add unit tests

* Add MysqlLock
Use that for the schema updates
Wait up to 30s for other schema updates to complete.

* Switch the schema lock back to a file lock for now.
Make FileLock support indefinite locking without polling.
Add a warning to MysqlLock for scenarios where it won't work.

* Delete MysqlLock.php

* Removed MySQL lock tests
2017-07-17 19:35:08 +01:00
Neil Lathwood
20ce209b27 Return more descriptive error when adding duplicate devices on sysName (#7019)
* Return more descriptive error when adding duplicate devices on sysName

* clean up functions to make more clear and reduce duplication

* moved return to correct place
2017-07-16 22:01:07 +01:00
Tony Murray
90aa485149 refactor: discovery code cleanups (#6856)
* Use foreach $key => value

* use get_port_by_ifIndex
get rid of the rest of the array_keys()

* improve hex_to_ip() function, add tests, use in more places

* Simplify can_skip_discovery logic
2017-06-22 21:08:20 +01:00
Tony Murray
7a87f12380 fix: custom config.php os settings (#6850)
fixes: #6848
2017-06-16 14:08:38 +01:00
Ivan
db47a43ce9 Added host to reachability failure message (#6680) 2017-05-18 21:03:55 +01:00
Neil Lathwood
6734e84382 feature: Added ability to whitelist ifDescr values from being ignored with good_if (#6584)
* feature: Added ability to whitelist ifDescr values from being ignored with good_if

* added ras to enterasys yaml
2017-05-05 15:18:33 -05:00
Tony Murray
4dbab407bb refactor: OS discovery tests are now dynamic (#6555)
* refactor: OS discovery tests are now dynamic
All that needs to be done now is supply snmprec files with the proper name. os.snmprec or os_description.snmprec
I also tweaked the loading of yaml files to speed up the tests substantially.
Verifies all os have at least one test and all snmprec files are tested.

* fix typo
2017-05-03 15:52:53 +01:00
Neil Lathwood
41e7689c77 refactor: DB Updates will now file level lock to stop duplicate updates (#6469)
* refactor: DB Updates will now file level lock to stop duplicate updates

* scrut fixes

* renamed function from clear_lock() to release_lock()
2017-05-03 14:48:23 +01:00
Tony Murray
4c0412b14d feature: Wireless Sensors Overhaul (#6471)
* feature: Wireless Sensors
Includes client counts for ios and unifi
Graphing could use some improvement.
Alerting and threshold ui not implemented

WIP: starting OO based wireless sensors.

Class based functionality working
remove old functional files
add schema file

discovery needs to be enabled, not polling

fix up schema

fix Unifi discovery not returning an array

Add some debug when discovering a sensor.
Fix style.

Add missing semicolin

Add a null object (Generic) for OS.
Fill out some phpdocs

Re-organized code
Each sensor type now has it's own discovery and polling interface
Custom polling tested with Unifi CCQ

Left to do:
Implement UI (Graphs and Custom thresholds)
Alerting
Testing

Fix event message text

Remove runDiscovery and runPolling from OS, they are unused and don't belong there.

Cleanups/docs

Missed this file.

Remove the requirement to fetch the current value to check validity.
Do that automatically if current is not specified
A few cleanups here and there

First pass at graphing.
device_ and wireless_ graphs added.

Add RouterOS support

Singleton OS instance isn't required right now.
Remove that to allow some memory to be freed.

Add wireless to the device list metrics.
Make all metrics clickable

Tweak graphs a bit

Implement limit configuration page.
Use sensors page as common code instead of duplicating.
Clean up some javascript interactions:  Allow enter on values to save. Cancel if update is not needed. Enable the clear custom button after setting a custom value.
Add some wireless alert rules to the library.

Add documentation.

Add unifi client counts by ssid in addition to radio.
Optimize Sensor polling a bit.

Add HP MSM clients support (for full controller)
Fix function accessibility

Formalize the discovery and poller interfaces.

Add Xirrus clients and noise floor
move module interfaces to a more appropriate place.
push caching code up to os, unsure about this do to the limitations

No point in selectively enabling wireless discovery.  We only discover if the device supports something.

Add RSSI, Power, and Rate.
Add these sensors for Ubnt Airos.
Clean up some copyrights.

Reduce the amount of files need to add new types.
Leave graph files for consistency and to allow customization.

Remove the old wifi clients graph completely.
ciscowlc should have improved counts (total and per-ssid)

Schema didn't get added.

Impelement the rest of the AirOS sensors
Reformat and re-organize the Airos.php class.

Add several UBNT AirFiber sensors

A few fixes add links to the section headers

Add HP MSM mibs.

* Schema file got dropped in rebase.

* Add wireless menu to view sensors across all devices.
Icons in the menu need help :/

* Add HeliOS, Mimosa, and Siklu support
Sensors added SNR + Noise

* Add power and utilization to Unifi

* Update polling to prefetch all sensor data in a few snmp requests as possible

* Add Extendair: tx+rx power, aggregate rate, frequency

* Add a check for duplicate sensors in discovery.  Just print an error for now.

* Add Bit Error Ratio (named error-ratio to allow for bit error rate to be added if needed)
Fix an incorrect link in the wireless sensors table

* Add error rate and change all bps and Hz to use si units

* Fixes to limits and frequency display

* Fix overview graph frequency display
A few decimal place tweaks

* Don't allow switching sensor and wireless-sensor graphs, it doesn't work.
Change individual distance graphs to use si units

* Go through the OS and make sure I got all the sensors I can (probably missed some still)
Because pollWirelessChannelAsFrequency() is generic and a little complex, so pull it up to OS.
Message to help developers adding supports that don't return an array from discover functions.

* Fix some issues

* Remove noise and signal for now at least
A couple more fixes
Add a notification

* Oopsie

* Bonus AirFiber sensors
2017-05-01 23:49:11 -05:00
Neil Lathwood
e7e5d51b30 newdevice: Added support for Exalt ExtendAir (#6524) 2017-04-29 15:58:06 +00:00
Neil Lathwood
d67d62eacb fix: Added more safety checking into create_state_index() so we do not end up with stale state names but no translation (#6516) 2017-04-27 22:33:56 -05:00
Neil Lathwood
153f0de12f fix: Actually reload oxidized when we should not when we think we should (#6515) 2017-04-27 22:31:48 -05:00
Tony Murray
1b1907a09f Update database tests to prepare for more (#6500)
* Update database tests to prepare for more
Add test_db_name, test_db_user, test_db_pass to allow developers to have a dedicated testing database.
Extract DBTestCase to include common functionality for database based tests. Use transactions to isolate tests.
Enable STRICT_TRANS_TABLE, test for it's existence (only when we have a user that can set it)
Move the database cleanup to register_shutdown_function, this makes it happen every time at the end of tests.
If the was not empty, only truncate the tables (that aren't prepopulated) instead of drop the database.
Use our schema functions for schema tests.
Fix some missing array indexes so it doesn't clutter test output.

* Fix style
2017-04-26 07:56:00 -05:00
Tony Murray
b4c4c39f55 feature: allow _except suffix in yaml os discovery (#6444)
Negates the selected check
2017-04-18 21:39:08 +01:00
Tony Murray
72ce39cf9b refactor: schema updates (#6370)
Test the schema files with STRICT_TRANS_TABLES and fix any issues
2017-04-13 10:18:12 +01:00
Tony Murray
0fd0b7cd6c Include the index name so the manual sql fix validates. (#6365) 2017-04-05 10:20:14 -05:00
Neil Lathwood
03deb6434a feature: Added ability to validate database schema (#6303)
* feature: Added ability to validate database schema

* small scrut fixes

* Check for extra tables and columns
Print 30 items of schema updates, easier to copy paste sql

* Now supports detections and suggested fix for:
tables: missing, extra
columns: missing, extra, incorrect
indexes: missing, extra, incorrect

* final changes + hook into travis
2017-04-05 09:00:28 +01:00
Neil Lathwood
be9f4839bf sql query bug fix (#6248) 2017-03-23 10:08:48 +00:00
pblasquez
c32a41a5bf Load config for new get_proxy function (#6247) 2017-03-23 06:48:10 +00:00
Neil Lathwood
5f5dc2a854 feature: Peeringdb integration to show the Exchanges and peers for your AS' (#6178) 2017-03-22 10:17:13 +00:00
Tony Murray
58495a3910 Add php docs for log_event, small cleanups (#6141)
* Add php docs for log_event, clean up eventlog_severity a bit.

* Update functions.php
2017-03-12 13:05:31 +00:00
towster
7bb9d58a07 feature: Store the username in eventlog for any entries created through the Webui (#6032)
* Added identification of user who removed a device to eventlog entry

* Fixed spaces

* updated to store username for all eventlog where applicable

* moved sql file

* updated
2017-03-11 07:03:52 -06:00
Neil Lathwood
8f96b14975 fix: API, remove extra utf8 encoding for json function (#6118) 2017-03-07 22:08:28 -06:00
Neil Lathwood
296360b204 fix: Update OSTicket transport to use the from email address #5739 (#5927) 2017-03-03 18:22:33 +00:00
towster
6612cb029d When 'mydomain' is set have host_exists check for both sysName and sysName.mydomin (#6052) 2017-03-03 14:27:56 +00:00
Tony Murray
20ae9e2ecd webui: Improve device header layout (#5990)
* webui: Improve device header layout

* Update css style version to break caches
Remove unused css.
2017-02-24 09:59:30 +00:00
Neil Lathwood
171e8da4bf fix: Remove sensors_to_state_indexes data before carrying on with generic data removal for delete_device() (#5982) 2017-02-23 23:03:07 +00:00
Neil Lathwood
92433f3511 feature: Added snmp_check() to decide if a device is up/down for snmp #5946 (#5948)
* feature: Added snmp_check() to decide if a device is up/down for snmp #5946

* added missing line

* Update snmp.inc.php
2017-02-23 22:47:18 +00:00
gilrim
1c9cbc42f5 api: Add ability to return all device info for get_devices_by_group() (#5971)
* Changed GetDevicesFromGroup to output all columns if  is defined in url
2017-02-22 09:37:40 +00:00
Tony Murray
8d528124a9 fix: addhost.php throw proper exception when database add fails (#5972)
* fix: addhost.php throw proper exception when database add fails
createHost() now throws an exception when adding to the database fails with a hint to run ./validate.php
Add phpdocs to createHost()
2017-02-22 09:12:31 +00:00
Tony Murray
0b7b24fd9d Add tests for functions (#5915)
cast isHexString to bool
2017-02-16 08:15:20 +00:00
Neil Lathwood
38168832a6 refactor: Centralise device up/down check and use in disco #5862 (#5897)
* refactor: Centralise device up/down check and use in disco #5862

* Remove extra indentation
2017-02-15 15:22:09 +00:00
Tony Murray
ebb1516db1 Icon was updated to an empty variable because it was not set on the $device array() (#5893) 2017-02-14 23:04:55 +00:00
Neil Lathwood
b4da5de452 refactor: Centralised the updating of device logo #5873 (#5874) 2017-02-14 12:56:16 +00:00
Richard Mayhew
5bfd23e7eb webui: New eventlog severity classification (#5830)
* New event log severity model

* Revert "New event log severity model"

This reverts commit 0783527af8.

* New event log severity model

* Fixed spaces vs tabs

* Learning the format requirements

* Learning the format requirements

* Moved the colours in to the stylesheet

* change SQL file to stop conflicting

* refactor log_event so severity isn't last, but reference is.

* keep having to move the file due to new PR conflicts

* Revert "keep having to move the file due to new PR conflicts"

This reverts commit f3030e7218.

* extended support to dashboard and eventlog page

* formatting
2017-02-12 22:41:05 +00:00
Tony Murray
a75ec7ab31 refactor: small function cleanups (#5865)
found while working on my snmp refactor
mac_clean_to_readable is about 33% improvement
hex2str is a moderate improvement
2017-02-12 13:20:06 +00:00
Neil Lathwood
aab1cdac49 Throw error when host already exists rather than say it is due to snmp (#5789) 2017-02-06 08:16:00 -06:00
Tony Murray
03f09118c1 refactor: move hp jetdirect discovery to yaml (#5757) 2017-02-04 10:02:05 +00:00
Neil Lathwood
7dc52654db fix: Ignore ports where we only have two entries in the array, this signals bad data #1366 (#5722)
* update to check for valid ports

* fix: Ignore ports where we only have two entries in the array, this signals bad data #1366

* Update functions.php
2017-02-03 19:49:40 +00:00
Neil Lathwood
a19b2614dc fix: added some timeout safeguards for curl calls (#5743) 2017-02-03 08:12:42 -06:00
Neil Lathwood
ba2f88ee72 Possible fix for #5318, if delete_device called in webui then continue to run (#5703)
* Possible fix for #5318, if delete_device called in webui then continue to run

* derp
2017-02-01 20:17:35 +00:00
Neil Lathwood
4390347508 fix: Ignore toners with values -2 which is unknown #5637 (#5654) 2017-01-31 08:07:50 +00:00
Tony Murray
f6fc5fdf71 webui: new generic os SVG icon (#5645) 2017-01-28 10:13:55 +00:00
Neil Lathwood
86445befde quick tidy up of dnslookup function #5633 (#5639) 2017-01-28 00:02:39 +00:00
Neil Lathwood
d464916136 fix code (#5586) 2017-01-24 23:36:33 +00:00