Variable not defined (using pmon_query).

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
Search

Post Reply
9 posts • Page 1 of 1
User avatar
NFedorenko
Posts: 45
Joined: Wed Jun 15, 2016 5:41 pm

Variable not defined (using pmon_query).

Post by NFedorenko »

Hello to all.

I need to get info about WinCC managers in my project.
I made a little script for a button:

Code: Select all

#uses "pmon"

main(mapping event)
{
  dyn_dyn_string res;
  pmon_query("MGRLIST:LIST", "localhost", 4999, res, true, true);
  DebugN(res);
}
But when I use it I got:
WCCOAui (1), 2019.01.21 11:52:04.059, CTRL, SEVERE, 176, Uncaught exception in thread started at main:
WCCOAui (1), 2019.01.21 11:52:04.058, CTRL, SEVERE, 73, Variable not defined,
Module: _QuickTest_
Panel: D:\ESDU_Project\ESDU\panels\dev\ManagerControl.xml [dev\ManagerControl.xml]
Object: 2 named: "PUSH_BUTTON1" of type: PUSH_BUTTON
Script: Clicked
Library: C:\Siemens\Automation\WinCC_OA\3.15\scripts\libs\pmon.ctl
Line: 512, gTcpFifo
Stacktrace:
1: pmon_query(string command = "MGRLIST:LIST
", string host = "localhost", int port = 4999, dyn_dyn_string & ddsResult = ({ 0 items }), bool showErrorDialog = TRUE, bool openTcp = TRUE) at pmon.ctl:512
2: main(mapping event = ([ 10 items ])) at [Module: _QuickTest_ Panel: dev\ManagerControl.xml Object: PUSH_BUTTON1 Script: Clicked]:6

What should I define, or what's wrong?

User avatar
leoknipp
Posts: 2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Variable not defined (using pmon_query).

Post by leoknipp »

If you want to use the (internal) functions defined in pmon.ctl you have to ensure that the requirements for these functions are fulfilled.
As the functions in pmon.ctl are made for WinCC OA internal tasks there is no detailed documentation available.

Which information to you want use in your WinCC OA project?
Which version and patch are you using?

Best Regards
Leopold Knipp
Senior Support Specialist

User avatar
NFedorenko
Posts: 45
Joined: Wed Jun 15, 2016 5:41 pm

Re: Variable not defined (using pmon_query).

Post by NFedorenko »

Thanks for your reply!

I need to get status of managers, start and stop them from ctrl-script, add\delete managers from ctrl-script.
Version - 3.15 p015

User avatar
leoknipp
Posts: 2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Variable not defined (using pmon_query).

Post by leoknipp »

If you want to stop a process (connected to the Event Manager) you can write the manager ID to the dp element _Managers(_2).Exit. The manager ID you can get by using the function convManIdToInt().

There is no need to call a PMon function to stop a manager.
If the startup option "always" is set the PMon will start the manager again.

You can have a look at the script pmonWatchdog.ctl to see how the pmon_query() functions works.
This script can be used to stop a blocking manager, details can be found in ReadmeP013.txt.

Why do you want to add/delete managers during runtime?

Best Regards
Leopold Knipp
Senior Support Specialist

User avatar
NFedorenko
Posts: 45
Joined: Wed Jun 15, 2016 5:41 pm

Re: Variable not defined (using pmon_query).

Post by NFedorenko »

Great!
But how can I start manager from ctrl-script?
I want to delete\add managers because of the information security solution.
If I can do that using WinCC OA console manualy, I think it's easy to do the same thing through ctrl script.

User avatar
leoknipp
Posts: 2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Variable not defined (using pmon_query).

Post by leoknipp »

You can have a look at the CTRL scripts defined in the panel panels/projAdmin/console.pnl to see how a manager status can be modified.

You have to keep in mind that a project can be password protected.
In that case you would have to define the password in plain text in your script if you want to access the Process Monitor. Defining a password in plain text is not the best solution.

Best Regards
Leopold Knipp
Senior Support Specialist

vakhnovetskiy
Posts: 1
Joined: Fri Aug 10, 2018 12:39 pm

Re: Variable not defined (using pmon_query).

Post by vakhnovetskiy »

Hello. Help me.

I use to function "pmonStopManager()" for manager stop and function "pmon_command()"
Version WinCCOA 3.15P15 and 3.16P001

My code:

Code: Select all

#uses "pmon.ctl"

main()
{
  DebugN("Start");
  bool err;
  pmonStopManager(err, "Proj1", 18, "root", "1234567");
  DebugN("Finish");
}
log:

WCCOActrl (3), 2019.02.12 14:15:37.262, CTRL, SEVERE, 176, Uncaught exception in thread started at main:
WCCOActrl (3), 2019.02.12 14:15:37.262, CTRL, SEVERE, 73, Variable not defined, ScriptStopManager.ctl Library: C:\Siemens\Automation\WinCC_OA\3.15\scripts\libs\pmon.ctl
Line: 370, gTcpFileDescriptor2
Stacktrace:
1: pmon_command(string command = "root#1234 ...", string host = "localhost", int port = 4999, bool showErrorDialog = FALSE, bool openTcp = FALSE) at pmon.ctl:370
2: pmonStopManager(bool & err = FALSE, string projName = "Proj1", int manPos = 18, string sUser = "root", string sPassword = "1234567") at pmon.ctl:741
3: main() at ScriptStopManager.ctl:7
WCCOActrl3:["Start"]
WCCOActrl (3), 2019.02.12 14:15:39.264, SYS, INFO, 181, Closing connection to (SYS: 55 Data -num 0 CONN: 1)
WCCOActrl (3), 2019.02.12 14:15:39.264, SYS, INFO, 181, Closing connection to (SYS: 55 Event -num 0 CONN: 1)
WCCILdata (0), 2019.02.12 14:15:39.264, SYS, INFO, 39, Connection lost, MAN: (SYS: 55 Ctrl -num 3 CONN: 1), Connection closed
WCCILevent (0), 2019.02.12 14:15:39.264, SYS, INFO, 39, Connection lost, MAN: (SYS: 55 Ctrl -num 3 CONN: 1), Connection closed
WCCOActrl (3), 2019.02.12 14:15:39.264, SYS, INFO, 39, Connection lost, MAN: (SYS: 55 Data -num 0 CONN: 1), Connection closed
WCCOActrl (3), 2019.02.12 14:15:39.265, SYS, INFO, 39, Connection lost, MAN: (SYS: 55 Event -num 0 CONN: 1), Connection closed
WCCOActrl (3), 2019.02.12 14:15:39.277, SYS, INFO, 2, Manager Stop

________________________________________________________________________________________

My code:

Code: Select all

#uses "pmon.ctl"

main()
{
  DebugN("Start");
  bool err;
  string str, projName, sUser, gPassword, host;
  int manPos, port;
  projName = "Proj1";
  manPos = 19;
  sUser = "root";
  gPassword = "1234567";
  port = 4999;
  host = "localhost";
  
  sprintf(str, "SINGLE_MGR:START %d", manPos);
  
  str = sUser+"#"+gPassword+"#"+str;
  
  pmon_command(str, host, port, true);
  DebugN("Finish");
}

log:

WCCOActrl (20), 2019.02.12 14:36:24.646, SYS, INFO, 103, User names/passwords initialized
WCCOActrl (20), 2019.02.12 14:36:24.786, PARAM,WARNING, 7, Datapoint does not exist, CtrlDbg::init, _CtrlDebug_CTRL_20.Command
WCCOActrl (20), 2019.02.12 14:36:24.786, CTRL, SEVERE, 176, Uncaught exception in thread started at main:
WCCOActrl (20), 2019.02.12 14:36:24.786, CTRL, SEVERE, 73, Variable not defined, ScriptStopManager.ctl Library: C:\Siemens\Automation\WinCC_OA\3.15\scripts\libs\pmon.ctl
Line: 370, gTcpFileDescriptor2
Stacktrace:
1: pmon_command(string command = "Proj1#1234 ...", string host = "localhost", int port = 4999, bool showErrorDialog = FALSE, bool openTcp = FALSE) at pmon.ctl:370
2: main() at ScriptStopManager.ctl:26
WCCOActrl20:["Start"]
WCCOActrl (20), 2019.02.12 14:36:26.789, SYS, INFO, 181, Closing connection to (SYS: 55 Data -num 0 CONN: 1)
WCCOActrl (20), 2019.02.12 14:36:26.789, SYS, INFO, 181, Closing connection to (SYS: 55 Event -num 0 CONN: 1)
WCCILdata (0), 2019.02.12 14:36:26.789, SYS, INFO, 39, Connection lost, MAN: (SYS: 55 Ctrl -num 20 CONN: 1), Connection closed
WCCILevent (0), 2019.02.12 14:36:26.789, SYS, INFO, 39, Connection lost, MAN: (SYS: 55 Ctrl -num 20 CONN: 1), Connection closed
WCCOActrl (20), 2019.02.12 14:36:26.789, SYS, INFO, 39, Connection lost, MAN: (SYS: 55 Data -num 0 CONN: 1), Connection closed
WCCOActrl (20), 2019.02.12 14:36:26.790, SYS, INFO, 39, Connection lost, MAN: (SYS: 55 Event -num 0 CONN: 1), Connection closed
WCCOActrl (20), 2019.02.12 14:36:26.803, SYS, INFO, 2, Manager Stop

User avatar
leoknipp
Posts: 2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Variable not defined (using pmon_query).

Post by leoknipp »

The log message show the information that variables are not defined.
If you want to use the (internal) functions defined in pmon.ctl you have to ensure that the requirements for these functions are fulfilled, e.g. all necessary variables are defined.

Did you have a look at the script pmonWatchdog.ctl to see which variables are defined for the pmon functions?

Best Regards
Leopold Knipp
Senior Support Specialist

vbalan007
Posts: 20
Joined: Fri Jul 28, 2017 7:11 am

Re: Variable not defined (using pmon_query).

Post by vbalan007 »

try using pmonWatchdog instead of pmon

Post Reply
9 posts • Page 1 of 1