Although this question may be closed, either for being a request for proof reading or for calling for an opinion on style, it does raise interesting points.
Neither version of your sentence is idiomatic English in the US. The reason is that you need the demonstrative adjective "that" instead of an article.
Preceding "dangerous state" by the indefinite article technically means that the system monitors only one of the possible states that are dangerous because unknown programs are running on the PC. That is not what you intend, and indeed most readers will fairly automatically catch what was intended because the literal meaning makes little sense. What you are intending to convey is that the system monitors for all cases when unknown programs are running on the PC without implying that those cases exhaust all possible types of dangerous condition. The way to say what you likely intend is to use "that."
"The system monitors whether your PC is in that dangerous state where unknown programs are running on it" indicates that, of the dangerous states that a PC may fall into, your system monitors the particular dangerous state arising from the presence of unknown programs.
If you start your sentence that way, you can then say "sounds an alert when detecting that state" or "when detecting that danger."
Demonstrative adjectives are a powerful but subtle tool of English.
You did not ask, but I find many defects of style in your sentence. One of the worst is using "unknown" because that word is ambiguous and may be deceptive. Most PC owners have many programs running that are unknown to them and not at all dangerous. In any case, does your system even know which programs are unknown to the owner of each PC? I suspect that you mean either "unknown to this monitoring system" or, more likely, "unapproved." If your system does not provide an alert if known malware is running, it may be legally or morally deceptive to imply that your system provides protection against dangerous programs. (This potential for deception is eliminated if the system is explicitly designed to supplement other systems that protect against known threats and if that supplementary role is clearly disclosed.)
On the assumption that you are monitoring for unapproved programs, I'd rewrite as
"This system monitors whether your PC is running any unapproved program and gives an alert as soon as that dangerous state is detected."