Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
David_Guan
Participant

Getting error when running CPView in a bash script at the background

Hi Everyone,

 

Recently due to multiple performance issues on the Checkpoint VSX, we have been trying to set up more monitors on Checkpoint platform and one of them is to record the history data of CPView.

As all of you may already know cpview history cannot be well supported on VSX platform, we are now testing a bash script to export the output of "cpview -p" to one file with timestamp appended and save to one specific folder. Pretty straightforward. We can manually run the script and get the result, however when scheduling the script to run every minute via crontab, we are getting below error:

CPView: Failed windows size ioctl with 22, Invalid argument

We then updated the script by using "when true;do...done" loop and use "nohup script.sh > /PATH/TO/LOG 2>&1 &" to run it at the background. No luck and we are getting the same error as above"

We then run the script directly with "&", and then use the disown command to clear the job. Got the same error.

We then run the script directly with "&", and then use the disown command with -h option on the job. This time it worked fine until we closed the putty client.

From the tests above it looks like "CPView -p" relies on terminal. Anyone had the same experience? And in this case how we can record the cpview history?

Thanks!

David

 

0 Kudos
7 Replies
PhoneBoy
Admin
Admin

We've "deprecated" cpview -p per this thread. You should be able to get the required data via SNMP.

0 Kudos
David_Guan
Participant

Hi PhoneBoy,

 

Thanks for sharing this. Didn't know that "cpview -p" has been deprecated.

 

Could u pls also recommend which SNMP monitor tool natively works well with Checkpoint VSX platform supporting polling on VSX gateway and multiple VS without too much customisation?

 

Thanks!

 

Regards,

David

0 Kudos
PhoneBoy
Admin
Admin

To be honest, I'm not familiar with the SNMP tools that are in-use today. They all require, at the very least, importing the MIB file. Beyond that, I defer to the rest of the community on their experience.
0 Kudos
_Val_
Admin
Admin

Any SNMP platform should be good here. Do not forget to enable Check Point snmp daemon and to put snmp into vsx mode, as per documentation 

0 Kudos
Maarten_Sjouw
Champion
Champion

Try to use "nohup script.sh >/dev/null 2>&1" and make sure the output of your commands are handled within the script.
Regards, Maarten
0 Kudos
David_Guan
Participant

Thanks will give it a try and let u know.

0 Kudos
Mario_Lucas
Participant

seems many people have had this issue over time, scripting cpview.

it appears to need a properly scoped tty to run happily. i have the following working, inside a script:

 

for x in yourlistofvsids; do
export gVSID="$x";
bash -i -c 'source /home/admin/.bash_profile; \
		source /home/admin/.bashrc; \
		source /etc/profile.d/vsenv.sh; \
		vsenv $gVSID; \
		/bin/./cpview_start.sh -p > $gVSID.log';
done

 

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events