Running external commands from a threshold

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Running external commands from a threshold

Post by TheWitness »

Depending on how you "escape", a '\\' may have to become '\\\\'. Just a clue. I hate Windows for that one reason, and I have a story about that being said from a guy who worked with DOS before the directory even existed (like in the 70's).
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
mrossTTX
Cacti User
Posts: 114
Joined: Wed Dec 07, 2022 12:49 pm

Re: Running external commands from a threshold

Post by mrossTTX »

i finally got it working
i misunderstood the command section. i THOUGHT you had to point it to a script file and not put the actual command in there.
so, i put C:\Windows\System32\sc.exe \\<HOSTNAME> start spooler in there and it worked!
now, my only issue is this
service is being monitiored.. its up.. all good
it stops.. thold sees that from the polling cycle, but has to wait a minium of 5 minutes to alert me its down, and fire off that command., which it does and starts the service.
service is running
next poll, cacti sees it, pulls data.. thold does tell me for another 10 minutes, as it isnt seeing it in the new state for that minimum 5 minutes yet.
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Running external commands from a threshold

Post by TheWitness »

Cool!
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
mrossTTX
Cacti User
Posts: 114
Joined: Wed Dec 07, 2022 12:49 pm

Re: Running external commands from a threshold

Post by mrossTTX »

it would be nice to be able to have it recheck a device it ran a command against and know that its not longer a breached threshold. as it stand now it takes 10 minutes to know if its back up
mrossFTEK
Posts: 22
Joined: Wed Jul 26, 2023 8:13 am

Re: Running external commands from a threshold

Post by mrossFTEK »

built a new server on win 2019.
the alerts for the tholds work, but its not firing off the command i put in the script box, which is
C:\Windows\System32\sc.exe \\<HOSTNAME> start WSusCertServer

as im monitoring the service for wsuscertserver
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Running external commands from a threshold

Post by TheWitness »

You may have to run the poller as a privileged account, or provide a credential that allows you to remote to the foreign host. Lastly, that script can write standard error anywhere you like it. My suggestion is instead of running a system command directly from thold, you run a script (cmd, ps, you name it), and then from there, get threshold attributes from the environment of that script "SET | grep THOLD" in Windows. (I so miss not having *NIX'isms in the native Windows. I hope you get the idea though).
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest