• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
SpiceCorps of San Diego presentation on Alerts
 

SpiceCorps of San Diego presentation on Alerts

on

  • 285 views

 

Statistics

Views

Total Views
285
Views on SlideShare
285
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    SpiceCorps of San Diego presentation on Alerts SpiceCorps of San Diego presentation on Alerts Presentation Transcript

    • Custom Notifications
      Spiceworks AlertsMichael Crook
      Senior Programmer Analyst
    • Download me @ http://ucsdhc-hi.ucsd.edu/spiceworks.pptx
    • Enable Custom Notifications in Spiceworks
      • From Settings open External Alerts
      • Enable external alert processing
      • Send your Spiceworks a notification e-Mail
    • Displaying your new alert
    • Different methods used for notifications triggers
      • Count files in a queue directory
      • Perform a command on a Unix server
      • Perform a Oracle DB query
    • What makes this all work
      • VBScript to send the email
      • In this example, Inventory device UCSDIFOUT is posting an alert “ORU_PCIS_ORM_WEBCHARTS > 25” ***** Nagios *****Host: UCSDIFOUTAddress: 172.16.82.89State: ORU_PCIS_ORM_WEBCHARTSService: ORU_PCIS_ORM_WEBCHARTS > 25Info: 30 ORU_PCIS_ORM_WEBCHARTS
    • Event_sender.vbs30 ORU_PCIS_ORM_WEBCHARTS 25 UCSDIFOUT
      ---------------------------------------------------------------------
      If Wscript.Arguments.Count = 0 Then
      Else
      dim dmsg
      dim cnt
      dim passed_msg
      dim watermark
      cnt = int(Wscript.Arguments(0) )
      passed_msg = Wscript.Arguments(1)
      watermark = int(Wscript.Arguments(2))
      server= Wscript.Arguments(3)
      Set o = CreateObject("CDO.Message")
      o.From = "Imaging Services Support <_@ucsd.edu>"
      o.To = "spiceworksserver@ucsd.edu"
      o.Subject = "Alert"&passed_msg
      if (cnt>watermark) then
      dmsg = " "&cnt&" "&passed_msg
      o.TextBody = "***** Nagios *****"&chr(13)&chr(10)& _
      "Host: "&server&chr(13)&chr(10)& _
      "Address: 172.16.000.000"&chr(13)&chr(10)& _
      "State: "&passed_msg&chr(13)&chr(10)& _
      "Service: "&passed_msg&" > "&watermark&chr(13)&chr(10)& _
      "Info: "&dmsg&
      else
      o.TextBody = "***** Nagios *****"&chr(13)&chr(10)& _
      "Host: "&server&chr(13)&chr(10)& _
      "Address: 172.16.000.000"&chr(13)&chr(10)& _
      "State: "&passed_msg&chr(13)&chr(10)& _
      "Service: "&passed_msg&" > "&watermark&chr(13)&chr(10)& _
      "Info: Cleared"
      End If
      o.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = “smtp.ucsd.edu"
      o.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      o.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      o.Configuration.Fields.Update
      o.Fields.Update
      o.send
      Set o = Nothing
      End If
      ---------------------------------------------------------------------
    • Run a command on a UNIX box and parse the result
      • Checking the CPU temp (prtdiag –v)
      • Run the command and return a filtered set of resultsplink.exe -pw pass -batch user@serverprtdiag -v |find "CPU%1 “
    • Use SQL commands to generate a Alert
      • Create a text file containing the commands to send to SQLPlus i.e.select count(*) from pending_transactions; exit;
      • To run the command and return a filtered result(Make sure your query only returns a single result)sqlplususer/pass@ODB @SQLfile.SQL|find " ">SQLfile.txt
      • Code example on next slide
    • Perform a Oracle DB Query and act on the result
      sqlplus%OracleUser%/%OraclePass%@%oracle_sid% @%QliktechHome%%SQLfile%.SQL |find " ">%QliktechHome%%SQLfile%.txt
      FOR /F "tokens=1" %%G IN ('type %QliktechHome%%SQLfile%.txt') DO SET _tempVar=%%G
      if %_tempVar% gtr %_watermark% (
      %QliktechHome%Event_sender.vbs %_tempVar% %_check_name% %_watermark% %_server%
      echo _ %_tempVar% >%_check_name%-%_watermark%-%_server%
      date /t >>log.txt
      time /t >>log.txt
      echo %QliktechHome%Event_sender.vbs %_tempVar% %_check_name% %_watermark% %_server% >>log.txt
      )
      if %_tempVar% lss %_watermark% (
      if exist %_check_name%-%_watermark%-%_server% (
      %QliktechHome%Event_sender.vbs %_tempVar% %_check_name% %_watermark% %_server%
      del /Q %_check_name%-%_watermark%-%_server%
      )
      )
    • Putty Link / Examples
      Putty Download Pagehttp://www.chiark.greenend.org.uk/~sgtatham/putty/download.html