Re: Help for policy (635 Views)
Reply
Advisor
shinji7800
Posts: 25
Registered: ‎09-13-2011
Message 1 of 11 (712 Views)

Help for policy

Hello,

 

I would like to create a specific policy to check a pattern.

 

 

for example I would like to verify this in a scope of equipments :

 

snmp-server host 192.168.1.10 RW_COMMUNITY

snmp-server host 192.168.0.10 RW_COMMUNITY

 

I want just this 2 lines (I don't want a third line snmp-server host).

 

so I create a policy rules with a text block :

 

block start pattern :

  • snmp-server enable traps ipsla

 

block end pattern :

  • snmp mib persist cbqos

 

a condition config block must contain only :

 

  • snmp-server host 192.168.1.10 RW_COMMUNITY
  • snmp-server host 192.168.0.10 RW_COMMUNITY

 

whatever the order

 

but  in the "but must not have any additional lines containing" I don't know what I can put in it ...

 

I have tried "snmp-server .*" but it doesn't works

 

 

have you some clues ?

 

 

Thanks

 

Best regards

 

HP Expert
_paul
Posts: 242
Registered: ‎05-24-2012
Message 2 of 11 (672 Views)

Re: Help for policy

Hello,

 

You can search the entire configuration to match those two specific lines, instead using start/end blocks. 

 

If that fails, you can do this other workaround if that one fails to show the needed: 

 

1) Create a Custom Diagnostic with the following command, or similar: show running | section snmp

2) Create a Policy on diagnostics on this particular one, to make sure the output contains just the lines you want. 

 

Let me know if this helps.

 

Thanks and regards,

Paul

Respected Contributor
mostafa_hassan
Posts: 287
Registered: ‎12-11-2011
Message 3 of 11 (657 Views)

Re: Help for policy

Hello Paul , 

 

 

Actually he needs to check there is only 2 lines with snmp-server host 

 

he need to check if there is any third line with that snmp-server host !!

 

i am interested also to know the solution for that !

 

How to create Policy on diagnostics for that !

All the best .
Saying Thanks by hitting Kudos :)

Regards
Mostafa Hassan
HP AIS NNM-NA-OO
CCNA-CCNP-ITIL-VCA-Cloud-VCA DataCenter
Frequent Advisor
Jay Bolster_1
Posts: 36
Registered: ‎05-13-2005
Message 4 of 11 (640 Views)

Re: Help for policy

na_rule.png

HP Expert
JFerong
Posts: 182
Registered: ‎05-17-2012
Message 5 of 11 (635 Views)

Re: Help for policy

Hi all;

 

I'm somewhat confused with this post.   Is there further action that needs to be taken on it?

 

 

Joe

Online outReach Resource
HP Support

The views and opinions expressed in my contributions are my own and do not necessarily reflect the views and strategy of HP

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
Respected Contributor
mostafa_hassan
Posts: 287
Registered: ‎12-11-2011
Message 6 of 11 (631 Views)

Re: Help for policy

Hello Joe ,

 


It's regarding to have Policy for SNMP configuration that has only 2 lines with SNMP servers ,

 

He doesn't need any additional SNMP-server command rather than which mentioned before

 

I think above Screenshot explain everything that is doable . 

 

All the best .
Saying Thanks by hitting Kudos :)

Regards
Mostafa Hassan
HP AIS NNM-NA-OO
CCNA-CCNP-ITIL-VCA-Cloud-VCA DataCenter
Occasional Visitor
lbrennan
Posts: 2
Registered: ‎11-12-2013
Message 7 of 11 (596 Views)

Re: Help for policy

Paul, can you explain where I can find out more information regarding policy on diagnostics, as you've mentioned in this post?

I'm wondering if it will help me solve a long term problem, creating policies for HA devices, so we only make changes to active devices and not standby (i.e Cisco ASA/F5 LTM pairs).
HP Expert
_paul
Posts: 242
Registered: ‎05-24-2012
Message 8 of 11 (591 Views)

Re: Help for policy

Hello,

 

There are some steps and information in the NA User Guide, still let us know what exactly are you interested into the policies on diagnostics? 

 

Mainly you create a diagnostic for your devices which runs regularly, then create a policy with rules on that diagnostic, and if needed with auto-remediation scripts to fix those non-compliant devices. 

 

Let us know on this matter.

 

Thanks and regards,

Paul

Occasional Visitor
lbrennan
Posts: 2
Registered: ‎11-12-2013
Message 9 of 11 (573 Views)

Re: Help for policy

Alot of my policy rules have the same conditions, find certain lines, but not any extra.  And my remediation scripts remove those extra lines.

 

Should look like this:

 

Condition 1: Config Text

- regular expression

 

Must contain only:

snmp-server host 192.168.1.10 RW_COMMUNITY

snmp-server host 192.168.0.10 RW_COMMUNITY

 

But must not have any additional lines containing:

^snmp-server host ([0-9].*)

 

 

 

Auto remediation script:

snmp-server host 192.168.1.10 RW_COMMUNITY

snmp-server host 192.168.0.10 RW_COMMUNITY

@foreach $matching_line$ in $condition_A_line_1$
no snmp-server host $matching_line.regex_group_1$
@end

Advisor
shinji7800
Posts: 25
Registered: ‎09-13-2011
Message 10 of 11 (546 Views)

Re: Help for policy

Hello,

 

thanks a lot for every one who take some time to answer me.

 

I'm sorry I was busy at work and I have no time for this problem.

 

I tried this :

rules_cond.JPG

rules_re.JPG

 

 

policies-comp.JPG

 

 

Sans titre.JPG

 

 

 

 

And as you can see there is something weird, HP NA detects correctelly wich ligne is wrong but it's doen't generate the script completely

 

@foreach doen't seems to works ... 

 

Valued Contributor
Chris_Powers
Posts: 137
Registered: ‎03-17-2011
Message 11 of 11 (516 Views)

Re: Help for policy

This is a guess on my part as I'm working on some similar problems, but try the script without the $tc_device_snmp_rw$ string.

Look at Example 4: Must Contain Only Operator in the NA User Guide for an example. It's similar to what you are doing.

-Chris
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.