Messaging Gateway

 View Only
Expand all | Collapse all

Any API in SMG can be used?

alexander smg

alexander smgJun 13, 2018 06:15 AM

alexander smg

alexander smgJun 14, 2018 06:22 AM

Migration User

Migration UserJun 14, 2018 09:13 PM

alexander smg

alexander smgJun 20, 2018 06:32 AM

alexander smg

alexander smgJun 29, 2018 02:52 PM

  • 1.  Any API in SMG can be used?

    Posted Jun 12, 2018 09:01 AM

    Checked, didn't find any, thinking use API to get some system status. 



  • 2.  RE: Any API in SMG can be used?

    Posted Jun 12, 2018 09:05 AM

    There is a development guide, which can be obtained from support.



  • 3.  RE: Any API in SMG can be used?

    Posted Jun 13, 2018 06:15 AM
    What do u want to accomplish?


  • 4.  RE: Any API in SMG can be used?

    Posted Jun 13, 2018 01:40 PM

    Would be great to get more details about what you would like to see an API for and reasons.



  • 5.  RE: Any API in SMG can be used?

    Posted Jun 14, 2018 06:22 AM
    Trying to accomplish what again?


  • 6.  RE: Any API in SMG can be used?

    Posted Jun 14, 2018 09:13 PM

    Thanks, let me open a case 



  • 7.  RE: Any API in SMG can be used?

    Posted Jun 14, 2018 09:14 PM

    What we wanted to do is to pull the message logs or any queue infomation instead of looking at the console.  Will check the  development guide see what can be done. 



  • 8.  RE: Any API in SMG can be used?

    Posted Jun 14, 2018 10:24 PM
    That would be cool if possible. Let us know if anything comes of it please.


  • 9.  RE: Any API in SMG can be used?

    Posted Jun 18, 2018 06:33 PM

    Message Logs can be brought remote via the remote log feature. This would send the message audit logs via syslog to a SIEM for additional processing.

     

    For the message queues you can leverage the output of the message audit log in SIEM to show everything that has not a state of delivery or something from your policy action like delete, what could show you what is in queue. In addition there is the SNMP option to see what is happening at the message queue.

    Let me know if that helps,

    toby 



  • 10.  RE: Any API in SMG can be used?

    Posted Jun 18, 2018 07:34 PM
    Thanks. But why should I use syslog to monitor what it should I be able to do on the SMG. There should be better queue monitoring. More granular options are deeply needed. Thanks


  • 11.  RE: Any API in SMG can be used?

    Posted Jun 18, 2018 09:30 PM

    Support said no such guide (API or development), any idea? 



  • 12.  RE: Any API in SMG can be used?

    Posted Jun 20, 2018 06:32 AM
    Need more queue logging options pls Toby. Thanks.


  • 13.  RE: Any API in SMG can be used?

    Posted Jun 21, 2018 03:11 AM

    Hi,

    I'm still not sure what u try to accomplish.

    You have a lot of choices as already mentioned above:

    - Syslog: We do use syslog as a sort of "backup" of comm-data, hist statistics and siem events.

    - SNMP: Could be used to get queue status etc but as its exposed to internet we prefer our implementation, see webinterface

    - Webinterface: Wrote a powershell script triggert by scheduler logging into webinterface and getting queue status, parsing it and setting eventlog events. Therefore scom is triggert by these custom events and scom events are handed over to siem.

    Thomas



  • 14.  RE: Any API in SMG can be used?

    Posted Jun 21, 2018 03:24 AM
    What does your Powershell code look like to accomplish this? Seems like a cool feature.


  • 15.  RE: Any API in SMG can be used?

    Posted Jun 28, 2018 12:35 PM

    Cant give you the hole script but for a good start

    1. Login like:
        Write-Host $url        #url is https://ip_name_CC//brightmail/viewLogin.do

        [net.httpWebRequest] $req = [net.webRequest]::create($url)
        $req.method = "GET"
        $req.Accept = "text/html"
        $req.AllowAutoRedirect = $true
        ...
        $match=$result | Select-String '(name="lastlogin" value="*.*")'
        #...some more replacing, spliting ...

        Write-Host $url2    #url2 is .../brightmail/login.do
        Write-Host $postData    #postData is username=xxx&password=xxx...

        [net.httpWebRequest] $req2 = [net.webRequest]::create($url2)
        $buffer = [text.encoding]::ascii.getbytes($postData)
        $req2.method = "POST"
        $req2.Accept = "text/html"
        $req2.CookieContainer = $CookieContainer
        $req2.ContentType = "application/x-www-form-urlencoded"
        $req2.ContentLength = $buffer.length
        # ...some more getResponse, IO.StreamReading

    2. Checking the queues, eg delivery queue:
        #as above but dont forget to use the cookie
        Write-Host .../brightmail/status/messageQueue/MessageQueueFlow$list.flo
        #get the IO.Stream and split it like "[INT]$count = $matches.Matches[$service.Result].value.Split('>*<')[2]"
        
    3. Check if the value is above your limit to alert:
        if ($count -gt $ServiceError)...
        Write-EventLog -LogName Application -Source $ServiceSource -EntryType Error -EventId $ErrorEventID -Message ...

    Regards

    Thomas



  • 16.  RE: Any API in SMG can be used?

    Posted Jun 28, 2018 02:47 PM
    Woo. This is gold. How did you know how to write this code.


  • 17.  RE: Any API in SMG can be used?

    Posted Jun 28, 2018 11:44 PM

    The problem is the logs in syslog breaks to mulitple lines, customer need to addtional custmization in the SIEM to parse out the logs. 



  • 18.  RE: Any API in SMG can be used?

    Posted Jun 28, 2018 11:48 PM
    It wasn't only me ;-) Got help from colleague, google&co, ms documentation like https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-6 Or https://stackoverflow.com/questions/22921529/powershell-webrequest-post Or If i remember correct take a look at sharepoint Update scripting Thomas


  • 19.  RE: Any API in SMG can be used?

    Posted Jun 29, 2018 06:10 AM
    So what app can I use to run this? Winamp, or putty?


  • 20.  RE: Any API in SMG can be used?

    Posted Jun 29, 2018 12:08 PM

    Come on, this is a part of a powershell script.

    Open scheduler on win and get it going

    Thomas



  • 21.  RE: Any API in SMG can be used?

    Posted Jun 29, 2018 02:52 PM
    Okay. I'll try it. Thx