One Line Troubleshooting scripts

One Line diagnostic scripts

These are all short, one line scripts that return results for all devices in the database. In iQSonar databases which have multiple projects or multiple scans, they will return large amounts of data, but may still prove useful, especially if exported to Excel for analysis.

Ping failures:

(i.e. the target is unreachable / offline)

Protocol 5 is ICMP (Ping)
--ping
select * from history.t_CommandHistory where ProtocolId=5 and message like '%Failed%' order by AttemptDate desc

Credentials

Find credential failure (all projects)
--SSH Login Failure
select * from history.t_connectionhistory where ProtocolID=2 and OutcomeID = 3 order by connectionhistoryid desc

--Windows Login Failure
select * from history.t_connectionhistory where ProtocolID in (3,4) and OutcomeID = 3 order by connectionhistoryid desc

--Oracle Login Failure
select * from history.t_connectionhistory where ProtocolID=7 and OutcomeID = 3 order by connectionhistoryid desc

-- MS SQL Login Failure
select * from history.t_connectionhistory where ProtocolID=8 and OutcomeID = 3 order by connectionhistoryid desc


Database Connection Failures:

--Oracle Connection Failure
select * from history.t_connectionhistory where ProtocolID=7 and OutcomeID = 3 order by connectionhistoryid desc

-– MS SQL Connection Failure
select * from history.t_connectionhistory where ProtocolID=8 and OutcomeID = 4 order by connectionhistoryid desc


We can also dig deeper into the Command History to check for specific failures, though that’s a bit tougher as there is a lot of information in that table and the results table – the basic listing is as follows:

select * from history.t_CommandHistory ch
join history.t_CommandHistoryResult chr on ch.CommandHistoryID = chr.CommandHistoryID