centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
311 stars 274 forks source link

IP camera HiWatch DS-I114W monitoring through ISAPI (similar to hardware::devices::hikvision::nvr::isapi::plugin) #4734

Closed Aleksey-Maksimov closed 11 months ago

Aleksey-Maksimov commented 11 months ago

Hello

We have a good plugin "hardware::devices::hikvision::nvr::isapi::plugin", which we made based on the case https://github.com/centreon/centreon-plugins/issues/3211

It is possible to create a new plugin with minimal effort using the developments of the plugin "hardware::devices::hikvision::nvr::isapi::plugin"

We have several HiWatch DS-I114W IP cameras in production. These cameras have microcode similar to Hikvision. They do not have SNMP support, but do have basic ISAPI support.

Can you please make a new plugin "hardware::devices::hiwatch::camera::isapi::plugin" similar to the plugin "hardware::devices::hikvision::nvr::isapi::plugin"? Only for the new plugin there are some nuances and I will explain them below.

------- Device Inventory --------

# ./centreon_plugins.pl '--plugin=hardware::devices::hikvision::nvr::isapi::plugin' '--mode=device' 
'--api-password' 'mypass' '--api-username' 'myuser' '--hostname' 'cam004' 
'--proto' 'https' '--ssl-opt' 'SSL_verify_mode => SSL_VERIFY_NONE' 

Model: DS-I114W, Serial: DS-I114W20171106AAWR123556070, Firmware: V5.4.81

That is, you can similarly create '--mode=device' for the plugin "hardware::devices::hiwatch::camera::isapi::plugin"

------- Device Uptime --------

# ./centreon_plugins.pl '--plugin=hardware::devices::hikvision::nvr::isapi::plugin' '--mode=uptime' 
'--api-password' 'mypass' '--api-username' 'myuser' '--hostname' 'cam004' 
'--proto' 'https' '--ssl-opt' 'SSL_verify_mode => SSL_VERIFY_NONE'

OK: System uptime is: 26m 2s | 'system.uptime.seconds'=1562;;;0;

That is, you can similarly create '--mode=uptime' for the plugin "hardware::devices::hiwatch::camera::isapi::plugin"

------- Memory Usage -------

# ./centreon_plugins.pl '--plugin=hardware::devices::hikvision::nvr::isapi::plugin' '--mode=memory' 
'--api-password' 'mypass' '--api-username' 'myuser' '--hostname' 'cam004' 
'--proto' 'https' '--ssl-opt' 'SSL_verify_mode => SSL_VERIFY_NONE' 
'--warning-memory-usage-prct' '90' '--critical-memory-usage-prct' '98' 
'--filter-perfdata' '(.usage.)' 

OK: memory usage total: 2.18 GB used: 97.00 MB (4.34%) free: 2.09 GB (95.66%) | 
'memory.usage.bytes'=101711872B;;;0;2341470208 
'memory.usage.percentage'=4.34%;0:90;0:98;0;100

That is, you can, by analogy, create '--mode=memory' for the plugin "hardware::devices::hiwatch::camera::isapi::plugin"

------- CPU Usage -------

# ./centreon_plugins.pl' '--plugin=hardware::devices::hikvision::nvr::isapi::plugin' '--mode=cpu' 
'--api-password' 'mypass' '--api-username' 'myuser' '--hostname' 'cam004' 
'--proto' 'https' '--ssl-opt' 'SSL_verify_mode => SSL_VERIFY_NONE' 

OK: Cpu utilization: 91.00% | 'cpu.utilization.percentage'=91%;;;0;100

That is, you can similarly create '--mode=cpu' for the plugin "hardware::devices::hiwatch::camera::isapi::plugin"

------- Device Time -------

# ./centreon_plugins.pl' '--plugin=hardware::devices::hikvision::nvr::isapi::plugin' '--mode=time' 
'--api-password' 'mypass' '--api-username' 'myuser' '--hostname' 'cam004' 
'--proto' 'https' '--ssl-opt' 'SSL_verify_mode => SSL_VERIFY_NONE' 
'--critical-offset' '-180:180' '--timezone' '+0300' '--warning-offset' '-60:60' --debug --verbose

UNKNOWN: Cannot find time informations
======> request send
...
======> response done
HTTP/1.1 200 OK
...
<?xml version="1.0" encoding="UTF-8"?>
<Time version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<timeMode opt="NTP,manual"/>
</Time>

That is, you can similarly create '--mode=time' for the plugin "hardware::devices::hiwatch::camera::isapi::plugin" But in order for this mode to work, you need to make a request to ISAPI not at /ISAPI/System/time/capabilities , but at /ISAPI/System/time Here is an example of the returned data:

<Time version="2.0">
<timeMode>NTP</timeMode>
<localTime>2023-11-09T18:32:36+03:00</localTime>
<timeZone>CST-3:00:00</timeZone>
</Time>

------- Device Protocols -------

# ./centreon_plugins.pl' '--plugin=hardware::devices::hikvision::nvr::isapi::plugin' '--mode=protocols' 
'--api-password' 'mypass' '--api-username' 'myuser' '--hostname' 'cam004' 
'--proto' 'https' '--ssl-opt' 'SSL_verify_mode => SSL_VERIFY_NONE'
'--warning-status' '(%{name} eq "RTSP" and %{enabled} eq "true") or (%{name} eq "HTTPS" and %{enabled} ne "true")' 
--debug --verbose

UNKNOWN: 400 Bad Request
======> request send
..
======> response done
HTTP/1.1 400 Bad Request
...
<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<requestURL>/ISAPI/Security/adminAccesses/capabilities</requestURL>
<statusCode>6</statusCode>
<statusString>Invalid XML Content</statusString>
<subStatusCode>badXmlContent</subStatusCode>
</ResponseStatus>

That is, you can similarly create '--mode=protocols' for the plugin "hardware::devices::hiwatch::camera::isapi::plugin" But in order for this mode to work, you need to make a request to ISAPI not at /ISAPI/Security/adminAccesses/capabilities , but at /ISAPI/Security/adminAccesses Here is an example of the returned data:

AdminAccessProtocolList version="2.0">
<AdminAccessProtocol version="2.0">
<id>1</id>
<protocol>HTTP</protocol>
<portNo>80</portNo>
</AdminAccessProtocol>
<AdminAccessProtocol version="2.0">
<id>2</id>
<enabled>true</enabled>
<protocol>HTTPS</protocol>
<portNo>443</portNo>
</AdminAccessProtocol>
<AdminAccessProtocol version="2.0">
<id>3</id>
<protocol>DEV_MANAGE</protocol>
<portNo>8000</portNo>
</AdminAccessProtocol>
<AdminAccessProtocol version="2.0">
<id>4</id>
<protocol>RTSP</protocol>
<portNo>554</portNo>
</AdminAccessProtocol>
</AdminAccessProtocolList>

If necessary, I am ready to provide additional information. Thank you.

Aleksey-Maksimov commented 11 months ago

Duplicated here https://thewatch.centreon.com/ideas/ip-camera-hiwatch-ds-i114w-monitoring-through-isapi-similar-to-hardware-devices-hikvision-nvr-isapi-plugin-2620

fmattesct commented 11 months ago

The Watch duplicate