Jul 07

SMC Batch Interaction – Checking Element Status

Hints and Tips, Scripts, SMC -
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3.00 out of 5)
Loading ... Loading ...
Add comments

This post adds another bit to the series of articles about SMC interaction through batch scripts.

Today scenario is similar to the following.
Suppose you have an installed base composed of several StoneGate Engines (IPS, Firewalls) plus few 3rd party devices that you monitor thanks to new cool feature of SMC 5.0.

You would like to allow batch scripting monitoring of such devices to have data from SMC to populate other processes or software you might use.

 

sgElementStatus script allows you to check the status of a given element in StoneGate Management Center. Syntax is reported below, but please note that output changes depending on element type. Some examples:

C:\Stonesoft\StoneGate\bin>sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element="FW-310-test"
(this is a Firewall)

Connect to Management Server: root@192.168.1.101
[1] FW-310-test: OK

C:\Stonesoft\StoneGate\bin>sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element="DefGW"
(this is a Router, monitored with 3rd Party monitoring)
Connect to Management Server: root@192.168.1.101
[1] DefGW: Online

C:\Stonesoft\StoneGate\bin>sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element="My-Network”

(this is a Network Element, silent output means element exist)
Connect to Management Server: root@192.168.1.101

C:\Stonesoft\StoneGate\bin>sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element="Test Apache Web"
(this is a Web Server, monitored but unreachable)

Connect to Management Server: root@192.168.1.101
[1] Test Apache Web: Unreachable

C:\Stonesoft\StoneGate\bin>sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element="My-non-existing-element"
(this is a fake name, not existing in SMC configuration)
Connect to Management Server: root@192.168.1.101
Script Failed
Not found: My-non-existing-element

C:\Stonesoft\StoneGate\bin>sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element="DefGW-notmon"
(this is a Router, not monitored)
Connect to Management Server: root@192.168.1.101

[1] DefGW-notmon: Not Monitored

Scripts are available in Files area of StoneBlog Community for Windows and for Linux.

written by RoarinPenguin - 1,518 views \\ tags: , , ,

Leave a Reply

You must be logged in to post a comment.