This project is read-only.

"Error saving Monitor Definition"

Topics: Developer Forum
Feb 14, 2007 at 7:52 PM
Sometimes when I'm editing monitor definitions, if I hit "save" while NOT on the "Settings" page, I'll get "Error saving Monitor Definition: Object reference not set to an instance of an object." Specifically, I've been changing operators and who gets contacted about what.

Also, It would be awesome if there was a way to select multiple Monitors and then change one or more parameters at once on ALL of them instead of having to do one at a time. I got like 20 monitors so far, but plan to add many more... I may just go into SQL Management Studio and do these types of updates via a query in the interim...

Thanks!!
Feb 15, 2007 at 3:33 AM
I have not experienced the problem you are reporting so far. Can you tell me what platform you are running manager on? (I've only really tested it under XP). Also, does the error message have any further information (maybe a stack trace or something)?
Is this confined to a single monitor type or multiple? Which one/ones? (Each monitor implements it's own "save" routine that builds up the XML so if this is limited to a single monitor it's probably in the specific monitor assembly and not in the generic monitor assembly).
Also, do you know if maybe some data was not typed in in some of the tabs? (Maybe I'm reading a Nothing value somewhere).
Anything additional info you cn provide would be great.
Thanks!
Fred.
Feb 26, 2007 at 4:47 PM
I created my first monitor, and whenever i try to save it I get root element not found.

Im using SQL2000/MSDE, on a win2003 machine. Any help?
Feb 26, 2007 at 4:49 PM
as a help i included the error report:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

                            • Exception Text **************
System.Exception: Root element is missing. ---> System.Exception: Root element is missing. ---> System.Xml.XmlException: Root element is missing.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at PolyMon.Monitors.MonitorMetadata.ReadMonitorMetadata(Int32 MonitorID)
--- End of inner exception stack trace ---
at PolyMon.Monitors.MonitorMetadata.ReadMonitorMetadata(Int32 MonitorID)
at PolyMon.Monitors.MonitorMetadata..ctor(Int32 MonitorID)
at PolyMon.Monitors.MonitorList.LoadMonitors()
--- End of inner exception stack trace ---
at PolyMon.Monitors.MonitorList.LoadMonitors()
at PolyMon.Monitors.MonitorList..ctor()
at PolyMonManager.frmMonitorDefs.LoadMonitorList(Int32 MonitorID)
at PolyMonManager.frmMonitorDefs.InitForm()
at PolyMonManager.frmMonitorDefs..ctor()
at PolyMonManager.frmMain.LoadChildForm(String FormName)
at PolyMonManager.frmMain.LoadForm_MonitorDefinitions(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


                            • Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
PolyMonManager
Assembly Version: 0.4.0.0
Win32 Version: 0.4.0.0
CodeBase: file:///C:/Program%20Files/PolyMon/PolyMon%20Manager/PolyMonManager.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/Microsoft.VisualBasic/8.0.0.0_b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System/2.0.0.0_b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System.Windows.Forms/2.0.0.0_b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System.Drawing/2.0.0.0_b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System.Runtime.Remoting/2.0.0.0_b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System.Configuration/2.0.0.0_b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System.Xml/2.0.0.0_b77a5c561934e089/System.Xml.dll
----------------------------------------
ndtnagcq
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System/2.0.0.0_b77a5c561934e089/System.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC32/System.Data/2.0.0.0_b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC32/System.Transactions/2.0.0.0_b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC32/System.EnterpriseServices/2.0.0.0_b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
PolyMon
Assembly Version: 0.4.0.0
Win32 Version: 0.4.0.0
CodeBase: file:///C:/Program%20Files/PolyMon/PolyMon%20Manager/PolyMon.DLL
----------------------------------------

                            • JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Feb 26, 2007 at 7:42 PM
I also found out that the service runs, but the tasks are never executed automatically.

I do assume that Local System has access to SQL Serv by default?
Feb 27, 2007 at 12:34 PM
Edited Feb 27, 2007 at 12:37 PM
It would appear that the monitor definition is not being saved to the database. Can you run a query against your database that retrieves the Monitor definition data, something like:
select * from Monitor --make sure your Monitor shows up in that result set

If this returns nothing then you are having problems saving data to the database. The connection string for connecting to the database is defined in the config files (for both Manager and Executive). Make sure your connection string is correct and that the authentication you are using will allow you to both read and write to the database.

If you do get data back from this query then that is not the problem. Next try running
exec polymon_sel_MonitorMetaData <ID>
Where ID is the id of your monitor, e.g.
exec polymon_sel_MonitorMetaData 1

This is the storec proc used by Manager to retrieve a Monitor definition and this seems to becausing the problem (the XML for the monitor returned by this stored proc apperas to be empty based on the stack trace you sent).

If this returns nothing than the database was not set up properly and you are likely missing entries in: MonitorType table. Did you run the Base Data.sql script? Were any errors thrown when doing this?

Thanks,
Fred.
Mar 1, 2007 at 4:35 PM
Edited Mar 1, 2007 at 8:14 PM
Fred,

Both queries return data, however I discovered that the XML is indeed empty.

MonitorID Name MonitorTypeID MonitorXML OfflineTime1Start OfflineTime1End
3 Website Retrieval 3 00:00 00:00 00:00 00:00

The default XML data is in the database as I can see it in the monitor types screen. When I have a clean setup, the first addition of a monitor works fine. But as I soon i try to edit/save it agian it will crash. When I try to view its status it will crash, also it does not record any values over the cycles.

So what is the exact problem here? The database was set up right, no errors, and I run all scripts.

BR,
Martin
Mar 2, 2007 at 3:42 AM
I found one bug that may or may not be the source of the problem. If you load a monitor definition with focus set to a tab other than the 1st tab, the XML settings are not populated (becuse I put the XML load in the Form load event and not the Form New) and if you save the monitor it will therefore save a blank XML setting. To reproduce the problem:
1. Open Monitor Defs.
2. Switch tab to any tab other than the 1st one.
3. Select a monitor from the monitor list
4. If you were to switch to Tab 1 you would see that the monitor definitions have not reloaded from the database. If you were to save the monitor you would then be saving a blank XML to the database.

So, a fairly typical scenario would be creating some monitor instances. Later going back to add operators to each one and loading monitors remaining on the operators tab. When saving the operator changes it will at the same time wipe out the xml settings.


I have fixed the problem in source code but have not released a new version yet. For now, please make sure that you always the 1st tab selected before selecting monitors from the list view.

Sorry about that...

Fred.
Mar 2, 2007 at 4:14 PM
Hi Fred,

That seemed to work, I have the XML in there right now.

However second problem is that no data is being recorded, only when i manually hit run.

Cycle is at 15 secs, enabled at 1 cycle per time.

But no history is being built. As long I do manual runs all the data goes in there, but as soon as I wait for the executive, no data is added, the executive is running though.

BR,
Martin
Mar 2, 2007 at 5:29 PM
Hi Martin,

Please try stopping and restarting the polymon service (you can use PolyMon Manager or Windows Service Manager).
I am also fixing this issue in the upcoming release.
Let me know if this worked or not.
Sorry about the bugs :(

Fred.
Mar 2, 2007 at 6:41 PM
Edited Mar 2, 2007 at 6:42 PM
This worked, however on the xml part i still get the error when I edit the monitor, then select first tab and press, still gives me the xml error.

data however is filling my database :)

Bugs are ok, as long as they are solved :) did you ever look at EventSentry? I think thats quite a nice way to have a deamon installed on another PC.
Mar 2, 2007 at 7:47 PM
Yes - the XML error will keep happening until I release the next version. I am assuming however that if you start editing an existing monitor with the 1st tab active, you can then save the monitor without any problems.

Glad to hear data is filling your database - upcoming release will ensure that it does not fill up too fast!

Not sure what feature you were talking about in EventSentry - there are plenty! Did you mean the Syslog Daemon?

Fred.
Mar 2, 2007 at 8:03 PM
In principle I like that you can install a deamon on another machine that reports statistics, im particulary interested in temperature of the CPU and harddisk space etc... I will have to look at WMI, and get my SNMP on my 2k3 machine working.

BR,
Martin
Mar 2, 2007 at 9:32 PM
Agreed - One thing I will be adding to PolyMon (but not in the nest release) is the ability to run multiple windows services all reporting back to the same database. In addition, someone suggested to add a PowerShell monitor plug-in - that's a great idea that I will also add in a future release. In theory, you could then run as many services as you like, each one running powershell scripts to poll and return such info, thereby allowing access to any stat that may only be available on the local machine instead of through remote calls.
Thanks,
Fred.