simple_host_monitoring 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/example01.rb +1 -1
- data/lib/basehost.rb +8 -5
- data/lib/localhost.rb +1 -1
- data/lib/simple_host_monitoring.rb +0 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6732bd4a85e1fc9b1355a78ad2f54a2d5dc69753
|
4
|
+
data.tar.gz: e991f9b532f4c11aab7961689064093ec7394549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49e1c27c5e45549d696877f6f5fbde2251a77e6590a7de86f8b00c128d633c92719153d48eeb684fae019b784cf1d7fd99a5bafc793e9467c94521ecf697249b
|
7
|
+
data.tar.gz: 6d77c1ff1563f7a1566ac527ed1f110755dcd88fa6384fa9cf3d8a251a6a9e2ee3e93209becdd6269ef4d37b40a9485ca77dacf6851876496b9c1b69a62a9a5b
|
data/examples/example01.rb
CHANGED
@@ -32,7 +32,7 @@ logger = BlackStack::LocalLoggerFactory.create('./example01.log')
|
|
32
32
|
|
33
33
|
#
|
34
34
|
while (true)
|
35
|
-
url = "https://euler.connectionsphere.com/api1.
|
35
|
+
url = "https://euler.connectionsphere.com/api1.3/hostsmonitoring/update.json"
|
36
36
|
api_key = '290582D4-D00C-4D37-82AF-23043B242647'
|
37
37
|
|
38
38
|
logger.logs "Flag start time... "
|
data/lib/basehost.rb
CHANGED
@@ -8,6 +8,12 @@ module BlackStack
|
|
8
8
|
|
9
9
|
module BaseHost
|
10
10
|
|
11
|
+
# ping Akamai to get my public ip address
|
12
|
+
# Reference: https://stackoverflow.com/questions/13270042/get-public-remote-ip-address
|
13
|
+
def remoteIp
|
14
|
+
open('http://whatismyip.akamai.com').read
|
15
|
+
end
|
16
|
+
|
11
17
|
# Map the status of this host to the attributes of the class
|
12
18
|
# Returns the hash descriptor of the object
|
13
19
|
def poll()
|
@@ -25,9 +31,6 @@ module BlackStack
|
|
25
31
|
mb_total_disk = stat.block_size * stat.blocks / 1024 / 1024
|
26
32
|
mb_free_disk = stat.block_size * stat.blocks_available / 1024 / 1024
|
27
33
|
|
28
|
-
# getting public Internet IP
|
29
|
-
#remote_ip = remoteIp()
|
30
|
-
|
31
34
|
# getting server name
|
32
35
|
hostname = Socket.gethostname
|
33
36
|
|
@@ -59,7 +62,7 @@ module BlackStack
|
|
59
62
|
|
60
63
|
# mapping lan attributes
|
61
64
|
self.net_hostname = hostname
|
62
|
-
|
65
|
+
self.net_remote_ip = remoteIp
|
63
66
|
self.net_mac_address = BlackStack::SimpleHostMonitoring.macaddress
|
64
67
|
|
65
68
|
self.to_hash
|
@@ -80,7 +83,7 @@ module BlackStack
|
|
80
83
|
:disk_total => self.disk_total,
|
81
84
|
:disk_free => self.disk_free,
|
82
85
|
:net_hostname => self.net_hostname,
|
83
|
-
|
86
|
+
:net_remote_ip => self.net_remote_ip,
|
84
87
|
:net_mac_address => self.net_mac_address
|
85
88
|
}
|
86
89
|
end
|
data/lib/localhost.rb
CHANGED
@@ -21,7 +21,7 @@ module BlackStack
|
|
21
21
|
self.disk_total = h[:disk_total]
|
22
22
|
self.disk_free = h[:disk_free]
|
23
23
|
self.net_hostname = h[:net_hostname]
|
24
|
-
|
24
|
+
self.net_remote_ip = h[:net_remote_ip]
|
25
25
|
self.net_mac_address = h[:net_mac_address]
|
26
26
|
end
|
27
27
|
|
@@ -22,25 +22,6 @@ module BlackStack
|
|
22
22
|
# if the file does not exists, it will ask the API for a GUID and create the file
|
23
23
|
HOST_ID_FILENAME = './host_id.data'
|
24
24
|
|
25
|
-
=begin # derepcated
|
26
|
-
@@host_id = nil
|
27
|
-
def self.reset_host_id
|
28
|
-
@@host_id = BlackStack::Pampa::get_guid
|
29
|
-
File.open(HOST_ID_FILENAME, 'w') {|f| f.write(@@host_id) }
|
30
|
-
@@host_id
|
31
|
-
end
|
32
|
-
def self.host_id
|
33
|
-
if @@host_id.nil?
|
34
|
-
if File.file?(HOST_ID_FILENAME)
|
35
|
-
@@host_id = File.read(HOST_ID_FILENAME)
|
36
|
-
else
|
37
|
-
@@host_id = self.reset_host_id
|
38
|
-
end
|
39
|
-
end # !@@host_id.nil?
|
40
|
-
@@host_id = self.reset_host_id if !@@host_id.guid?
|
41
|
-
@@host_id
|
42
|
-
end
|
43
|
-
=end
|
44
25
|
# This function works in windows only
|
45
26
|
# TODO: Esta funcion no retorna la mac address completa
|
46
27
|
# TODO: Validar que no se retorne una macaddress virtual, con todos valores en 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_host_monitoring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket
|