* Finished (though known bugs exist) scan-lvm.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 2f4a06f2e0
commit aaa330dd41
  1. 10
      notes
  2. 2
      scancore-agents/scan-hardware/scan-hardware
  3. 1028
      scancore-agents/scan-lvm/scan-lvm
  4. 8
      scancore-agents/scan-lvm/scan-lvm.sql
  5. 198
      scancore-agents/scan-lvm/scan-lvm.xml

10
notes

@ -424,6 +424,16 @@ CREATE TRIGGER trigger_server_definitions
AFTER INSERT OR UPDATE ON server_definitions AFTER INSERT OR UPDATE ON server_definitions
FOR EACH ROW EXECUTE PROCEDURE history_server_definitions(); FOR EACH ROW EXECUTE PROCEDURE history_server_definitions();
DROP TABLE updated;
CREATE TABLE updated (
updated_uuid uuid not null primary key,
updated_host_uuid uuid not null,
updated_by text not null, -- The name of the agent (or "ScanCore' itself) that updated.
modified_date timestamp with time zone not null,
FOREIGN KEY(updated_host_uuid) REFERENCES hosts(host_uuid)
);
ALTER TABLE updated OWNER TO admin;
COMMIT; COMMIT;

@ -1008,8 +1008,6 @@ SET
WHERE WHERE
scan_hardware_uuid = ".$anvil->Database->quote($scan_hardware_uuid)." scan_hardware_uuid = ".$anvil->Database->quote($scan_hardware_uuid)."
;"; ;";
# Now record the query in the array
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Database->write({query => $query, source => $THIS_FILE, line => __LINE__}); $anvil->Database->write({query => $query, source => $THIS_FILE, line => __LINE__});
} }

File diff suppressed because it is too large Load Diff

@ -51,7 +51,7 @@ BEGIN
history_scan_lvm_pvs.scan_lvm_pv_used_by_vg, history_scan_lvm_pvs.scan_lvm_pv_used_by_vg,
history_scan_lvm_pvs.scan_lvm_pv_attributes, history_scan_lvm_pvs.scan_lvm_pv_attributes,
history_scan_lvm_pvs.scan_lvm_pv_size, history_scan_lvm_pvs.scan_lvm_pv_size,
history_scan_lvm_pvs.scan_lvm_pv_used, history_scan_lvm_pvs.scan_lvm_pv_free,
history_scan_lvm_pvs.modified_date); history_scan_lvm_pvs.modified_date);
RETURN NULL; RETURN NULL;
END; END;
@ -132,10 +132,9 @@ CREATE TABLE scan_lvm_lvs (
scan_lvm_lv_uuid uuid primary key, -- This comes from the VG itself. scan_lvm_lv_uuid uuid primary key, -- This comes from the VG itself.
scan_lvm_lv_host_uuid uuid not null, scan_lvm_lv_host_uuid uuid not null,
scan_lvm_lv_name text not null, -- This is the name of the VG. scan_lvm_lv_name text not null, -- This is the name of the VG.
scan_lvm_lv_attributes text not null, -- This is the short 10-character attribute of the LV scan_lvm_lv_attributes text not null, -- This is the short 9-character attribute of the LV
scan_lvm_lv_on_vg text not null, -- This is the name of the volume group this LV is on scan_lvm_lv_on_vg text not null, -- This is the name of the volume group this LV is on
scan_lvm_lv_size numeric not null, -- The size of the VG, in bytes. scan_lvm_lv_size numeric not null, -- The size of the VG, in bytes.
scan_lvm_lv_free numeric not null, -- The free space in the VG, in bytes.
scan_lvm_lv_path text not null, -- The device path to this LV scan_lvm_lv_path text not null, -- The device path to this LV
scan_lvm_lv_on_pvs text not null, -- This is a comma-separated list of PVs this LV spans over. scan_lvm_lv_on_pvs text not null, -- This is a comma-separated list of PVs this LV spans over.
modified_date timestamp with time zone not null, modified_date timestamp with time zone not null,
@ -152,7 +151,6 @@ CREATE TABLE history.scan_lvm_lvs (
scan_lvm_lv_attributes text, scan_lvm_lv_attributes text,
scan_lvm_lv_on_vg text, scan_lvm_lv_on_vg text,
scan_lvm_lv_size numeric, scan_lvm_lv_size numeric,
scan_lvm_lv_free numeric,
scan_lvm_lv_path text, scan_lvm_lv_path text,
scan_lvm_lv_on_pvs text, scan_lvm_lv_on_pvs text,
modified_date timestamp with time zone not null modified_date timestamp with time zone not null
@ -172,7 +170,6 @@ BEGIN
scan_lvm_lv_attributes, scan_lvm_lv_attributes,
scan_lvm_lv_on_vg, scan_lvm_lv_on_vg,
scan_lvm_lv_size, scan_lvm_lv_size,
scan_lvm_lv_free,
scan_lvm_lv_path, scan_lvm_lv_path,
scan_lvm_lv_on_pvs, scan_lvm_lv_on_pvs,
modified_date) modified_date)
@ -183,7 +180,6 @@ BEGIN
history_scan_lvm_lvs.scan_lvm_lv_attributes, history_scan_lvm_lvs.scan_lvm_lv_attributes,
history_scan_lvm_lvs.scan_lvm_lv_on_vg, history_scan_lvm_lvs.scan_lvm_lv_on_vg,
history_scan_lvm_lvs.scan_lvm_lv_size, history_scan_lvm_lvs.scan_lvm_lv_size,
history_scan_lvm_lvs.scan_lvm_lv_free,
history_scan_lvm_lvs.scan_lvm_lv_path, history_scan_lvm_lvs.scan_lvm_lv_path,
history_scan_lvm_lvs.scan_lvm_lv_on_pvs, history_scan_lvm_lvs.scan_lvm_lv_on_pvs,
history_scan_lvm_lvs.modified_date); history_scan_lvm_lvs.modified_date);

@ -14,8 +14,202 @@ NOTE: All string keys MUST be prefixed with the agent name! ie: 'scan_lvm_log_00
<language name="en_CA" long_name="Canadian English" description="ScanCore scan agent that monitors hardware, like RAM modules, CSS LED status, CPU information, etc."> <language name="en_CA" long_name="Canadian English" description="ScanCore scan agent that monitors hardware, like RAM modules, CSS LED status, CPU information, etc.">
<!-- Alert entries --> <!-- Alert entries -->
<key name="scan_lvm_alert_0001"></key> <key name="scan_lvm_alert_0001">The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has returned. This is normal if the PV is on a removable medium like a USB disk.</key>
<key name="scan_lvm_alert_0002">The physical volume: [#!variable!old_pv_name!#] (UUID: [#!variable!pv_uuid!#]) has changed to: [#!variable!new_pv_name!#].</key>
<key name="scan_lvm_alert_0003">The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has vanished! If this is a removable device, like a USB drive, this is OK. Otherwise, it could be the sign of a disk failure.</key>
<key name="scan_lvm_alert_0004">The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has been assigned to the volume group: [#!variable!vg_name!#].</key>
<key name="scan_lvm_alert_0005">The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has been assigned to the volume group: [#!variable!new_vg_name!#]. It used to be assigned to: [#!variable!old_vg_name!#]. Did the volume group name change? If so, then this is not a concern.</key>
<key name="scan_lvm_alert_0006">The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) attribute bits have changed from: [#!variable!old_attributes!#] to: [#!variable!new_attributes!#].
The attribute bits are:
1 - (d)uplicate, (a)llocatable, (u)sed
2 - e(x)ported
3 - (m)issing
</key>
<key name="scan_lvm_alert_0007">The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has increased in size from: [#!variable!old_pv_size!#] (#!variable!old_pv_size_bytes!# bytes) to: [#!variable!new_pv_size!#] (#!variable!new_pv_size_bytes!# bytes). This is the expected if you grew the disk.</key>
<key name="scan_lvm_alert_0008">The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has decreased in size from: [#!variable!old_pv_size!#] (#!variable!old_pv_size_bytes!# bytes) to: [#!variable!new_pv_size!#] (#!variable!new_pv_size_bytes!# bytes).</key>
<key name="scan_lvm_alert_0009">The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) free space has decreased in size from: [#!variable!old_pv_free!#] (#!variable!old_pv_free_bytes!# bytes) to: [#!variable!new_pv_free!#] (#!variable!new_pv_free_bytes!# bytes). This is expected if you grew the PV to use a grown disk.</key>
<key name="scan_lvm_alert_0010">The physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) free space has increased in size from: [#!variable!old_pv_free!#] (#!variable!old_pv_free_bytes!# bytes) to: [#!variable!new_pv_free!#] (#!variable!new_pv_free_bytes!# bytes).</key>
<key name="scan_lvm_alert_0011">The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has returned. This is normal if the VG is on a removable medium like a USB disk.</key>
<key name="scan_lvm_alert_0012">The volume group: [#!variable!old_vg_name!#] (UUID: [#!variable!vg_uuid!#]) has changed to: [#!variable!new_vg_name!#].</key>
<key name="scan_lvm_alert_0013">The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) attribute bits have changed from: [#!variable!old_attributes!#] to: [#!variable!new_attributes!#].
The attribute bits are:
1 - Permissions: (w)riteable, (r)ead-only
2 - Resi(z)eable
3 - E(x)ported
4 - (p)artial: one or more physical volumes belonging to the volume group are missing from the system
5 - Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere
6 - (c)lustered, (s)hared
</key>
<key name="scan_lvm_alert_0014">The volume group: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) extent size has changed from: [#!variable!old_vg_extent_size!#] (#!variable!old_vg_extent_size_bytes!# bytes) to: [#!variable!new_pv_size!#] (#!variable!new_pv_size_bytes!# bytes). This should never happen...</key>
<key name="scan_lvm_alert_0015">The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has increased in size from: [#!variable!old_vg_size!#] (#!variable!old_vg_size_bytes!# bytes) to: [#!variable!new_vg_size!#] (#!variable!new_vg_size_bytes!# bytes). This is the expected if you added a PV to this VG.</key>
<key name="scan_lvm_alert_0016">The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has decreased in size from: [#!variable!old_vg_size!#] (#!variable!old_vg_size_bytes!# bytes) to: [#!variable!new_vg_size!#] (#!variable!new_vg_size_bytes!# bytes).</key>
<key name="scan_lvm_alert_0017">The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) free space has decreased in size from: [#!variable!old_vg_free!#] (#!variable!old_vg_free_bytes!# bytes) to: [#!variable!new_vg_free!#] (#!variable!new_vg_free_bytes!# bytes). This is expected if you grew an existing LV or created a new one.</key>
<key name="scan_lvm_alert_0018">The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) free space has increased in size from: [#!variable!old_vg_free!#] (#!variable!old_vg_free_bytes!# bytes) to: [#!variable!new_vg_free!#] (#!variable!new_vg_free_bytes!# bytes). This is expected if you removed an old LV.</key>
<key name="scan_lvm_alert_0019">The new physical volume: [#!variable!pv_name!#] (UUID: [#!variable!pv_uuid!#]) has been found.
Assigned to VG: [#!variable!vg_name!#]
Attribute bits: [#!variable!attributes!#]
PV Size: ...... [#!variable!pv_size!#] (#!variable!pv_size_bytes!# bytes)
Free Space: ... [#!variable!pv_free!#] (#!variable!pv_free_bytes!# bytes)
The attribute bits are:
1 - (d)uplicate, (a)llocatable, (u)sed
2 - e(x)ported
3 - (m)issing
</key>
<key name="scan_lvm_alert_0020">The new volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has been found.
Attribute bits: [#!variable!attributes!#]
VG Size: ...... [#!variable!vg_size!#] (#!variable!vg_size_bytes!# bytes)
Free Space: ... [#!variable!vg_free!#] (#!variable!vg_free_bytes!# bytes)
Extent Size: .. [#!variable!extent_size!#] (#!variable!extent_size_bytes!# bytes)
The attribute bits are:
1 - Permissions: (w)riteable, (r)ead-only
2 - Resi(z)eable
3 - E(x)ported
4 - (p)artial: one or more physical volumes belonging to the volume group are missing from the system
5 - Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere
6 - (c)lustered, (s)hared
</key>
<key name="scan_lvm_alert_0021">The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) has returned. This is normal if the LV is on a removable medium like a USB disk.</key>
<key name="scan_lvm_alert_0022">The logical volume: [#!variable!old_lv_name!#] (UUID: [#!variable!lv_uuid!#]) has changed to: [#!variable!new_lv_name!#].</key>
<key name="scan_lvm_alert_0023">The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) attribute bits have changed from: [#!variable!old_attributes!#] to: [#!variable!new_attributes!#].
The attribute bits are:
1 - Volume type:
* (C)ache,
* (m)irrored,
* (M)irrored without initial sync,
* (o)rigin,
* (O)rigin with merging snapshot,
* (r)aid,
* (R)aid without initial sync,
* (s)napshot,
* merging (S)napshot,
* (p)vmove,
* (v)irtual,
* mirror or raid (i)mage,
* mirror or raid (I)mage out-of-sync,
* mirror (l)og device,
* under (c)onversion,
* thin (V)olume,
* (t)hin pool,
* (T)hin pool data,
* v(d)o pool,
* v(D)o pool data,
* raid or pool m(e)tadata or pool metadata spare.
2 - Permissions:
* (w)riteable,
* (r)ead-only,
* (R)ead-only activation of non-read-only volume
3 - Allocation policy:
* (a)nywhere,
* (c)ontiguous,
* (i)nherited,
* c(l)ing,
* (n)ormal This is capitalised if the volume is currently locked against allocation changes, for example during pvmove.
4 - fixed (m)inor
5 - State:
* (a)ctive,
* (h)istorical,
* (s)uspended,
* (I)nvalid snapshot,
* invalid (S)uspended snapshot,
* snapshot (m)erge failed,
* suspended snapshot (M)erge failed,
* mapped (d)evice present without tables,
* mapped device present with (i)nactive table,
* thin-pool (c)heck needed,
* suspended thin-pool (C)heck needed,
* (X) unknown
6 - device
* (o)pen,
* (X) unknown
7 - Target type:
* (C)ache,
* (m)irror,
* (r)aid,
* (s)napshot,
* (t)hin,
* (u)nknown,
* (v)irtual.
8 - Newly-allocated data blocks are overwritten with blocks of (z)eroes before use.
9 - Volume Health, where there are currently three groups of attributes identified:
</key>
<key name="scan_lvm_alert_0024">The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) is on a volume group that has changed its name from: [#!variable!old_lv_on_vg!#] to: [#!variable!new_lv_on_vg!#].</key>
<key name="scan_lvm_alert_0025">The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) has increased in size from: [#!variable!old_lv_size!#] (#!variable!old_lv_size_bytes!# bytes) to: [#!variable!new_lv_size!#] (#!variable!new_lv_size_bytes!# bytes). This is expected when an LV is extended.</key>
<key name="scan_lvm_alert_0026">The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) has decreased in size from: [#!variable!old_lv_size!#] (#!variable!old_lv_size_bytes!# bytes) to: [#!variable!new_lv_size!#] (#!variable!new_lv_size_bytes!# bytes). This is expected when an LV is shrunk.</key>
<key name="scan_lvm_alert_0027">The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) device path has changed from: [#!variable!old_lv_path!#] to: [#!variable!new_lv_path!#].</key>
<key name="scan_lvm_alert_0028">The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) list of physical volumes is spans has changed from: [#!variable!old_lv_on_pvs!#] to: [#!variable!new_lv_on_pvs!#].</key>
<key name="scan_lvm_alert_0029">The new logical volume: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has been found.
Attribute bits: [#!variable!attributes!#]
LV on VG: ..... [#!variable!lv_on_vg!#]
LV Size: ...... [#!variable!vg_size!#] (#!variable!vg_size_bytes!# bytes)
Device path: .. [#!variable!lv_on_vg!#]
Using PV(s): .. [#!variable!lv_on_pvs!#]
The attribute bits are:
1 - Volume type:
* (C)ache,
* (m)irrored,
* (M)irrored without initial sync,
* (o)rigin,
* (O)rigin with merging snapshot,
* (r)aid,
* (R)aid without initial sync,
* (s)napshot,
* merging (S)napshot,
* (p)vmove,
* (v)irtual,
* mirror or raid (i)mage,
* mirror or raid (I)mage out-of-sync,
* mirror (l)og device,
* under (c)onversion,
* thin (V)olume,
* (t)hin pool,
* (T)hin pool data,
* v(d)o pool,
* v(D)o pool data,
* raid or pool m(e)tadata or pool metadata spare.
2 - Permissions:
* (w)riteable,
* (r)ead-only,
* (R)ead-only activation of non-read-only volume
3 - Allocation policy:
* (a)nywhere,
* (c)ontiguous,
* (i)nherited,
* c(l)ing,
* (n)ormal This is capitalised if the volume is currently locked against allocation changes, for example during pvmove.
4 - fixed (m)inor
5 - State:
* (a)ctive,
* (h)istorical,
* (s)uspended,
* (I)nvalid snapshot,
* invalid (S)uspended snapshot,
* snapshot (m)erge failed,
* suspended snapshot (M)erge failed,
* mapped (d)evice present without tables,
* mapped device present with (i)nactive table,
* thin-pool (c)heck needed,
* suspended thin-pool (C)heck needed,
* (X) unknown
6 - device
* (o)pen,
* (X) unknown
7 - Target type:
* (C)ache,
* (m)irror,
* (r)aid,
* (s)napshot,
* (t)hin,
* (u)nknown,
* (v)irtual.
8 - Newly-allocated data blocks are overwritten with blocks of (z)eroes before use.
9 - Volume Health, where there are currently three groups of attributes identified:
</key>
<key name="scan_lvm_alert_0030">The volume group: [#!variable!vg_name!#] (UUID: [#!variable!vg_uuid!#]) has vanished! If this is a removable device, like a USB drive, this is OK. Otherwise, it could be the sign of a disk failure.</key>
<key name="scan_lvm_alert_0031">The logical volume: [#!variable!lv_name!#] (UUID: [#!variable!lv_uuid!#]) has been lost. This is normal if the LV is on a removable medium like a USB disk. Otherwise, it could be the sign of a disk failure.</key>
<!-- Log entries --> <!-- Log entries -->
<key name="scan_lvm_log_0001">Starting: [#!variable!program!#].</key> <key name="scan_lvm_log_0001">Starting: [#!variable!program!#].</key>

Loading…
Cancel
Save