Dimanche, Novembre 7, 2021
Etendre la partition / sous Fedora
Se connecter avec le user root
Démonter la partition /home
Le plus simple depuis l’aplication Disk
lvresize -L -20G --resizefs /dev/fedora_localhost-live/home
vgs
lvresize -L +20G --resizefs /dev/fedora_localhost-live/root
Restart
c’est OK !
Vendredi, Novembre 5, 2021
Info sur les derniers failover
C’est le genre d’information à garder dans un dashboard ou bien un rapport régulier.
Les failover du jour
SELECT
TOLOCAL(e.EventTime) AS [Failover time]
, SUBSTRING(
e.Message, -- which colomn
CHARINDEX('''',e.Message)+1, --where to start
CHARINDEX('''',e.Message,(CHARINDEX('''',e.Message)+1) )- CHARINDEX('''',e.Message)-1 -- where to end
) AS [Pool Name]
, SUBSTRING(
e.Message, -- which colomn
CHARINDEX('Pool member',e.Message)+length('Pool member ''') , --where to start
(CHARINDEX('''',e.Message,CHARINDEX('Pool member',e.Message)+length('Pool member ''')) ) - (CHARINDEX('Pool member',e.Message)+length('Pool member ''')) -- where to end
) AS [From Poller]
,SUBSTRING(
e.Message,
CHARINDEX('Pool member',e.Message,CHARINDEX('changed',e.Message))+length('Pool member ''',CHARINDEX('''',e.Message,CHARINDEX('Pool member',e.Message)+length('Pool member '''))),
(CHARINDEX('''',e.Message,CHARINDEX('Pool member',e.Message)+length('Pool member ''')) ) - (CHARINDEX('Pool member',e.Message)+length('Pool member '''))
) AS [To Poller]
, SUBSTRING(
e.Message,
CHARINDEX('Reason of fail',e.Message)+length('Reason of fail: '),
length(e.Message)-CHARINDEX('Reason of fail',e.Message)
) as [Reason]
FROM
orion.Events e
JOIN
orion.HA.Pools p on p.DisplayName = SUBSTRING(
e.Message, -- which colomn
CHARINDEX('''',e.Message)+1, --where to start
CHARINDEX('''',e.Message,(CHARINDEX('''',e.Message)+1) )- CHARINDEX('''',e.Message)-1 -- where to end
)
WHERE
e.EventType = 6500
AND TOLOCAL(e.EventTime) > DATETRUNC('day',GETDATE())
ORDER BY e.EventTime DESC
Failover des 2 derniers jours
select top 15
tolocal(e.EventTime) as [Failover time] --, e.Message
, SUBSTRING(
e.message, -- which colomn
charindex('''',e.message)+1, --where to start
charindex('''',e.message,(charindex('''',e.message)+1) )- charindex('''',e.message)-1 -- where to end
) as [Pool Name]
, SUBSTRING(
e.message, -- which colomn
charindex('Pool member',e.message)+length('Pool member ''') , --where to start
(charindex('''',e.message,charindex('Pool member',e.message)+length('Pool member ''')) ) - (charindex('Pool member',e.message)+length('Pool member ''')) -- where to end
) as [From Poller]
,substring(
e.Message,
charindex('Pool member',e.message,charindex('changed',e.message))+length('Pool member ''',charindex('''',e.message,charindex('Pool member',e.message)+length('Pool member '''))),
(charindex('''',e.message,charindex('Pool member',e.message)+length('Pool member ''')) ) - (charindex('Pool member',e.message)+length('Pool member '''))
) as [To Poller]
, substring(
e.message,
charindex('Reason of fail',e.message)+length('Reason of fail: '),
length(e.message)-charindex('Reason of fail',e.message)
) as [Reason]
from orion.Events e
join orion.HA.Pools p on p.DisplayName = SUBSTRING(
e.message, -- which colomn
charindex('''',e.message)+1, --where to start
charindex('''',e.message,(charindex('''',e.message)+1) )- charindex('''',e.message)-1 -- where to end
)
where e.EventType = 6500
and tolocal(e.EventTime) < DateTrunc('day',GETDATE())
and tolocal(e.EventTime) > DateTrunc('day',addday(-2,GETDATE()))
order by e.EventTime desc
Les 10 derniers failover
select top 10
tolocal(e.EventTime) as [Failover time]
, SUBSTRING(
e.message, -- which colomn
charindex('''',e.message)+1, --where to start
charindex('''',e.message,(charindex('''',e.message)+1) )- charindex('''',e.message)-1 -- where to end
) as [Pool Name]
, SUBSTRING(
e.message, -- which colomn
charindex('Pool member',e.message)+length('Pool member ''') , --where to start
(charindex('''',e.message,charindex('Pool member',e.message)+length('Pool member ''')) ) - (charindex('Pool member',e.message)+length('Pool member ''')) -- where to end
) as [From Poller]
,substring(
e.Message,
charindex('Pool member',e.message,charindex('changed',e.message))+length('Pool member ''',charindex('''',e.message,charindex('Pool member',e.message)+length('Pool member '''))),
(charindex('''',e.message,charindex('Pool member',e.message)+length('Pool member ''')) ) - (charindex('Pool member',e.message)+length('Pool member '''))
) as [To Poller]
, substring(
e.message,
charindex('Reason of fail',e.message)+length('Reason of fail: '),
length(e.message)-charindex('Reason of fail',e.message)
) as [Reason]
from orion.Events e
join orion.HA.Pools p on p.DisplayName = SUBSTRING(
e.message, -- which colomn
charindex('''',e.message)+1, --where to start
charindex('''',e.message,(charindex('''',e.message)+1) )- charindex('''',e.message)-1 -- where to end
)
where e.EventType = 6500
--and tolocal(e.EventTime) > DateTrunc('day',GETDATE())
order by e.EventTime desc
Configuration des DB
Récupération de configuration des données en SWQL
SELECT
sql.Node.Caption,
sql.InstanceName,
sql.ProductVersion,
sql.ProductLevel,
sql.Edition,
sql.Name,type.value,
(CASE
WHEN type.Value = 'Static' THEN port.Value
ELSE 1433
END) as PortNumber
FROM
Orion.APM.SqlServerApplication as sql
LEFT JOIN
Orion.APM.ApplicationSettings as port ON sql.ApplicationID = port.ApplicationID
LEFT JOIN
Orion.APM.ApplicationSettings as type ON sql.ApplicationID = type.ApplicationID
WHERE
port.Key = 'PortNumber'
AND type.Key = 'PortType'
ORDER BY
sql.Node.Caption,
sql.InstanceName
Equivalent Grep sous Windows
Get-ChildItem -Path D:tempfolder_to_test_scripts -recurse -Include "*.bat" | Select-String REM | select Path, LineNumber
Vendredi, Octobre 29, 2021
Trouver toutes les IPs d’une machine
Afficher les IPs d’une machine
SELECT
nia.node.Vendor, nia.node.MachineType,
nia.Node.Caption,
nia.IPAddress
FROM
Orion.NodeIPAddresses nia
WHERE
nia.IPAddress not in ('::1','127.0.0.1') and nia.Node.Caption = 'mytestmachine' -- exclusion des loopback et filtre sur la machine 'mytestmachine'
ORDER BY
nia.Node.Vendor,
nia.Node.MachineType,
nia.Node.Caption
Afficher les IPs dupliquées
SELECT
nia.Node.Caption as [Node 1],
nia.IPAddress,
nia2.Node.Caption as [Node 2]
FROM
Orion.NodeIPAddresses nia
JOIN
Orion.NodeIPAddresses nia2 ON nia.IPAddress = nia2.IPAddress
AND nia.NodeID != nia2.NodeID
Afficher toutes les IPs de tous les nodes
SELECT
nia.node.Vendor, nia.node.MachineType,
nia.Node.Caption,
nia.IPAddress
FROM
Orion.NodeIPAddresses nia
WHERE
nia.IPAddress not in ('::1','127.0.0.1') -- exclusion des loopback
ORDER BY
nia.Node.Vendor,
nia.Node.MachineType,
nia.Node.Caption